changeset 2167:1a0a80db36d6 draft

Check length before accessing memory to silence valgrind.
author Roy Marples <roy@marples.name>
date Wed, 27 Nov 2013 21:35:45 +0000
parents e3224a33d655
children 6133c1c25912
files dhcp-common.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dhcp-common.c	Wed Nov 27 21:14:43 2013 +0000
+++ b/dhcp-common.c	Wed Nov 27 21:35:45 2013 +0000
@@ -217,7 +217,7 @@
 		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;