From: Roy Marples Date: Wed, 27 Nov 2013 21:35:45 +0000 (+0000) Subject: Check length before accessing memory to silence valgrind. X-Git-Tag: v6.2.0~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=26add2b59fbb3a4a9af63d094cb8a835c61bc528;p=thirdparty%2Fdhcpcd.git Check length before accessing memory to silence valgrind. --- diff --git a/dhcp-common.c b/dhcp-common.c index 917f5d2b..cbd55dcf 100644 --- a/dhcp-common.c +++ b/dhcp-common.c @@ -217,7 +217,7 @@ decode_rfc3397(char *out, ssize_t len, int pl, const uint8_t *p) hops = 0; /* We check we are inside our length again incase * the data is NOT terminated correctly. */ - while ((l = *q++) && q - p < pl) { + while (q - p < pl && (l = *q++)) { ltype = l & 0xc0; if (ltype == 0x80 || ltype == 0x40) return 0;