Merge pull request #15889 from evverx/15885

network: Fix crash when SendOption= is invalid
This commit is contained in:
Evgeny Vereshchagin 2020-05-22 20:08:55 +03:00 committed by GitHub
commit 0aeb407cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -499,7 +499,7 @@ int config_parse_dhcp_send_option(
r = extract_first_word(&p, &word, ":", 0);
if (r == -ENOMEM)
return log_oom();
if (r <= 0) {
if (r <= 0 || isempty(p)) {
log_syntax(unit, LOG_ERR, filename, line, r,
"Invalid DHCP option, ignoring assignment: %s", rvalue);
return 0;

View File

@ -0,0 +1,9 @@
[DHCPv4]
SendOption=1:string:
SendOption=1:uint8:
SendOption=1:uint16:
SendOption=1:uint32:
SendOption=1:ipv4address:
SendOption=1:ipv4address:127.0.0.1
SendOption=1:ipv6address:
SendOption=1:ipv6address:52:54:00:b9:b5:61