mirror of
https://github.com/rsmarples/dhcpcd.git
synced 2024-12-02 22:45:04 +08:00
Fix ClientID parsing.
This commit is contained in:
parent
7896eaf023
commit
3aa5b6ed1a
5
dhcpcd.c
5
dhcpcd.c
@ -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
10
net.c
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user