mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 03:25:31 +03:00
sd-bus: check for potential integer overflow in KDBUS_ITEM_FOREACH()
For large values of item->size, the 'part' pointer can wrap around, which results in an illegal pointer, but currently passes the for-loop condition.
This commit is contained in:
parent
2a781fc9bd
commit
b629d09842
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user