summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-bus/bus-kernel.h')
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.h b/src/libsystemd/sd-bus/bus-kernel.h
index c4722cbac6..a1e9691f1d 100644
--- a/src/libsystemd/sd-bus/bus-kernel.h
+++ b/src/libsystemd/sd-bus/bus-kernel.h
@@ -31,7 +31,8 @@
#define KDBUS_ITEM_FOREACH(part, head, first) \
for (part = (head)->first; \
- (uint8_t *)(part) < (uint8_t *)(head) + (head)->size; \
+ ((uint8_t *)(part) < (uint8_t *)(head) + (head)->size) && \
+ ((uint8_t *) part >= (uint8_t *) head); \
part = KDBUS_ITEM_NEXT(part))
#define KDBUS_ITEM_HEADER_SIZE offsetof(struct kdbus_item, data)