Skip to content

Commit

Permalink
Merge pull request #15889 from evverx/15885
Browse files Browse the repository at this point in the history
network: Fix crash when SendOption= is invalid
  • Loading branch information
evverx committed May 22, 2020
2 parents fbc6d17 + 0d52665 commit 0aeb407
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/network/networkd-dhcp-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions test/fuzz/fuzz-network-parser/github-15885
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0aeb407

Please sign in to comment.