From: Daniel Mack Date: Mon, 26 Jan 2015 18:24:12 +0000 (+0100) Subject: test: add check for pointer arithmetic overflow X-Git-Tag: upstream/0.20150129.081441utc~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b15fb734cc4619a90badb48920aa697f4aef0355;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git 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 --- diff --git a/test/kdbus-util.h b/test/kdbus-util.h index 5f30aa8..d052fd8 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))