mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-07 17:17:44 +03:00
dhcp: make sure we can deal with a single trailing NUL byte in the hostname
Fixes #1337
This commit is contained in:
parent
fe08a30b58
commit
e989fd9b67
@ -314,7 +314,11 @@ static int lease_parse_string(const uint8_t *option, size_t len, char **ret) {
|
|||||||
else {
|
else {
|
||||||
char *string;
|
char *string;
|
||||||
|
|
||||||
if (memchr(option, 0, len))
|
/*
|
||||||
|
* One trailing NUL byte is OK, we don't mind. See:
|
||||||
|
* https://github.com/systemd/systemd/issues/1337
|
||||||
|
*/
|
||||||
|
if (memchr(option, 0, len - 1))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
string = strndup((const char *) option, len);
|
string = strndup((const char *) option, len);
|
||||||
|
Loading…
Reference in New Issue
Block a user