diff options
| author | Roy Marples <roy@marples.name> | 2008-08-05 22:04:34 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-08-05 22:04:34 +0000 |
| commit | a6d8a84a142a44764ccd292c8d468ab4d07c58cc (patch) | |
| tree | a93b08c03d45d8398624e8510a6e541eae6ba828 /dhcp.c | |
| parent | 6faa58fe5b8fee66179af85a928125728d6d3269 (diff) | |
| download | dhcpcd-a6d8a84a142a44764ccd292c8d468ab4d07c58cc.tar.xz | |
Respect hostname length.
Diffstat (limited to 'dhcp.c')
| -rw-r--r-- | dhcp.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -713,10 +713,8 @@ make_message(struct dhcp_message **message, uint32_t ul; uint16_t sz; const struct dhcp_opt *opt; -#ifndef MINIMAL uint8_t *d; - const char *c; -#endif + const char *c, *e; dhcp = xzalloc(sizeof (*dhcp)); m = (uint8_t *)dhcp; @@ -854,8 +852,9 @@ make_message(struct dhcp_message **message, *p++ = 0; /* from server for PTR RR */ *p++ = 0; /* from server for A RR if S=1 */ c = options->hostname + 1; + e = c + options->hostname[0]; d = p++; - while (*c) { + while (c < e) { if (*c == '.') { *d = p - d - 1; d = p++; @@ -863,7 +862,7 @@ make_message(struct dhcp_message **message, *p++ = (uint8_t) *c; c++; } - *p ++ = 0; + *p++ = 0; } } |
