summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Dill2003-12-24 19:57:13 +0000
committerRuss Dill2003-12-24 19:57:13 +0000
commitd242e49c894cd0a8b6b016e8f1865651c1c5fef7 (patch)
treeed7384761891f887b9ad5dcc4e1152666c573874
parenta8992635b117723e65078ada845cc88a9cb77aa3 (diff)
downloadbusybox-d242e49c894cd0a8b6b016e8f1865651c1c5fef7.zip
busybox-d242e49c894cd0a8b6b016e8f1865651c1c5fef7.tar.gz
fix a long standing underallocation bug
-rw-r--r--networking/udhcp/script.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index 1f74cd7..24688b5 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -146,8 +146,11 @@ static char **fill_envp(struct dhcpMessage *packet)
num_options = 0;
else {
for (i = 0; dhcp_options[i].code; i++)
- if (get_option(packet, dhcp_options[i].code))
+ if (get_option(packet, dhcp_options[i].code)) {
num_options++;
+ if (dhcp_options[i].code == DHCP_SUBNET)
+ num_options++; /* for mton */
+ }
if (packet->siaddr) num_options++;
if ((temp = get_option(packet, DHCP_OPTION_OVER)))
over = *temp;
@@ -194,7 +197,7 @@ static char **fill_envp(struct dhcpMessage *packet)
/* watch out for invalid packets */
packet->sname[sizeof(packet->sname) - 1] = '\0';
asprintf(&envp[j++], "sname=%s", packet->sname);
- }
+ }
return envp;
}