From: Roy Marples Date: Sat, 18 Oct 2008 22:58:10 +0000 (+0000) Subject: Alloc less for options and correctly for inform. X-Git-Tag: v5.0.0~212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9754dc73797d69cf999993af8f1f9f445d359ff4;p=thirdparty%2Fdhcpcd.git Alloc less for options and correctly for inform. --- diff --git a/dhcp.c b/dhcp.c index 3b698dae..79d7b003 100644 --- a/dhcp.c +++ b/dhcp.c @@ -1088,17 +1088,22 @@ print_option(char *s, ssize_t len, int type, int dl, const uint8_t *data) if (!s) { if (type & UINT8) l = 3; - else if (type & UINT16) + else if (type & UINT16) { l = 5; - else if (type & SINT16) + dl /= 2; + } else if (type & SINT16) { l = 6; - else if (type & UINT32) + dl /= 2; + } else if (type & UINT32) { l = 10; - else if (type & SINT32) + dl /= 4; + } else if (type & SINT32) { l = 11; - else if (type & IPV4) + dl /= 4; + } else if (type & IPV4) { l = 16; - else { + dl /= 4; + } else { errno = EINVAL; return -1; } @@ -1188,7 +1193,7 @@ configure_env(char **env, const char *prefix, const struct dhcp_message *dhcp, if (get_option_raw(dhcp, opt->option)) e++; } - if (dhcp->yiaddr) + if (dhcp->yiaddr || dhcp->ciaddr) e += 5; if (*dhcp->bootfile && !(overl & 1)) e++;