changeset 1196:db1bfa6b44dd draft

Just terminate the DHCP message if not terminated. DHO_PAD could be valid data.
author Roy Marples <roy@marples.name>
date Thu, 29 Jan 2009 13:56:12 +0000
parents 79eaf16a52c6
children 44123747e58b
files client.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/client.c	Thu Jan 29 13:09:23 2009 +0000
+++ b/client.c	Thu Jan 29 13:56:12 2009 +0000
@@ -1581,10 +1581,8 @@
 		}
 		/* We should ensure that the packet is terminated correctly
 		 * if we have space for the terminator */
-		if ((size_t)bytes < sizeof(struct dhcp_message)) {
-			p = (uint8_t *)dhcp + bytes - 1;
-			while (p > dhcp->options && *p == DHO_PAD)
-				p--;
+		if ((size_t)bytes != sizeof(*dhcp)) {
+			p = (uint8_t *)dhcp + (bytes - 1);
 			if (*p != DHO_END)
 				*++p = DHO_END;
 		}