diff options
author | Daniel Mack <daniel@zonque.org> | 2015-01-26 19:24:12 +0100 |
---|---|---|
committer | Daniel Mack <daniel@zonque.org> | 2015-01-26 19:24:12 +0100 |
commit | b15fb734cc4619a90badb48920aa697f4aef0355 (patch) | |
tree | 91a52d5a874e0b04dbbe76ee7296727f30d5cf0a | |
parent | 1262d9e580cdab18501bd4020505f718ccc51f06 (diff) | |
download | kdbus-bus-b15fb734cc4619a90badb48920aa697f4aef0355.tar.gz kdbus-bus-b15fb734cc4619a90badb48920aa697f4aef0355.tar.bz2 kdbus-bus-b15fb734cc4619a90badb48920aa697f4aef0355.zip |
test: add check for pointer arithmetic overflow
It's not crucial to have this in the test suite, but we should follow
our own examples.
Signed-off-by: Daniel Mack <daniel@zonque.org>
-rw-r--r-- | test/kdbus-util.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/kdbus-util.h b/test/kdbus-util.h index 5f30aa8ea20..d052fd8b3ed 100644 --- a/test/kdbus-util.h +++ b/test/kdbus-util.h @@ -29,7 +29,8 @@ (typeof(item))(((uint8_t *)item) + KDBUS_ALIGN8((item)->size)) #define KDBUS_ITEM_FOREACH(item, head, first) \ for (item = (head)->first; \ - (uint8_t *)(item) < (uint8_t *)(head) + (head)->size; \ + ((uint8_t *)(item) < (uint8_t *)(head) + (head)->size) && \ + ((uint8_t *)(item) >= (uint8_t *)(head)); \ item = KDBUS_ITEM_NEXT(item)) |