diff --git a/CHANGELOG b/CHANGELOG index aabeb5a..195a696 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -21,6 +21,12 @@ version 2.87 Add snooping of IPv6 prefix-delegations to the DHCP-relay system. + Finesse parsing of --dhcp-remoteid and --dhcp-subscrid. To be treated + as hex, the pattern must consist of only hex digits AND contain + at least one ':'. Thanks to Bengt-Erik Sandstrom who tripped + over a pattern consisting of a decimal number which was interpreted + surprisingly. + version 2.86 Handle DHCPREBIND requests in the DHCPv6 server code. diff --git a/src/option.c b/src/option.c index 7e7b9fb..ff54def 100644 --- a/src/option.c +++ b/src/option.c @@ -4128,7 +4128,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma case LOPT_SUBSCR: /* --dhcp-subscrid */ { unsigned char *p; - int dig = 0; + int dig, colon; struct dhcp_vendor *new = opt_malloc(sizeof(struct dhcp_vendor)); if (!(comma = split(arg))) @@ -4152,13 +4152,16 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma else comma = arg; - for (p = (unsigned char *)comma; *p; p++) + for (dig = 0, colon = 0, p = (unsigned char *)comma; *p; p++) if (isxdigit(*p)) dig = 1; - else if (*p != ':') + else if (*p == ':') + colon = 1; + else break; + unhide_metas(comma); - if (option == 'U' || option == 'j' || *p || !dig) + if (option == 'U' || option == 'j' || *p || !dig || !colon) { new->len = strlen(comma); new->data = opt_malloc(new->len);