network/dhcp: actually refuse to assign DHCP option when an invalid string is passed

Prompted by #30029.
This commit is contained in:
Yu Watanabe
2023-11-18 11:19:17 +00:00
committed by Luca Boccassi
parent 67df554047
commit fbf946ce22
2 changed files with 8 additions and 1 deletions
+3 -1
View File
@@ -1014,9 +1014,11 @@ int config_parse_dhcp_send_option(
}
case DHCP_OPTION_DATA_STRING:
sz = cunescape(p, UNESCAPE_ACCEPT_NUL, &q);
if (sz < 0)
if (sz < 0) {
log_syntax(unit, LOG_WARNING, filename, line, sz,
"Failed to decode DHCP option data, ignoring assignment: %s", p);
return 0;
}
udata = q;
break;
@@ -0,0 +1,5 @@
[DHCPv6]
SendOption=1:string:\U
SendVendorOption=123:1:string:\U
[DHCPv4]
SendOption=1:string:\U