Fix ClientID parsing.

This commit is contained in:
Roy Marples 2008-07-02 09:48:53 +00:00
parent 7896eaf023
commit 3aa5b6ed1a
2 changed files with 7 additions and 8 deletions

View File

@ -445,14 +445,13 @@ parse_option(int opt, char *oarg, struct options *options)
oarg, CLIENTID_MAX_LEN);
return -1;
}
if (strlcpy(options->clientid + 1, oarg,
if (strlcpy(options->clientid, oarg,
CLIENTID_MAX_LEN) == 0)
{
/* empty string disabled duid */
options->options &= ~DHCPCD_DUID;
options->options &= ~DHCPCD_CLIENTID;
} else
options->clientid[0] = strlen(oarg);
}
} else {
options->clientid[0] = '\0';
options->options &= ~DHCPCD_DUID;

10
net.c
View File

@ -148,11 +148,6 @@ hwaddr_aton(unsigned char *buffer, const char *addr)
while (*p) {
c[0] = *p++;
c[1] = *p++;
/* Ensure that next data is EOL or a seperator with data */
if (!(*p == '\0' || (*p == ':' && *(p + 1) != '\0'))) {
errno = EINVAL;
return 0;
}
/* Ensure that digits are hex */
if (isxdigit((unsigned char)c[0]) == 0 ||
isxdigit((unsigned char)c[1]) == 0)
@ -160,6 +155,11 @@ hwaddr_aton(unsigned char *buffer, const char *addr)
errno = EINVAL;
return 0;
}
/* Ensure that next data is EOL or a seperator with data */
if (!(*p == '\0' || (*p == ':' && *(p + 1) != '\0'))) {
errno = EINVAL;
return 0;
}
if (*p)
p++;
if (bp)