]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Check length before accessing memory to silence valgrind.
authorRoy Marples <roy@marples.name>
Wed, 27 Nov 2013 21:35:45 +0000 (21:35 +0000)
committerRoy Marples <roy@marples.name>
Wed, 27 Nov 2013 21:35:45 +0000 (21:35 +0000)
dhcp-common.c

index 917f5d2b9d33f936873dda79102386b5f92abb53..cbd55dcf5b3c1e3773d58590b14f7f8e7790bbd6 100644 (file)
@@ -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;