network: refuse string which contains non-safe or non-ascii characters for Filename=
The string will be used when the client load additional config file to boot, and it must be a valid path or url. Hence, let's refuse non-safe or non-characters.
This commit is contained in:
@@ -286,7 +286,7 @@ int sd_dhcp_server_set_next_server(sd_dhcp_server *server, const struct in_addr
|
||||
int sd_dhcp_server_set_filename(sd_dhcp_server *server, const char *filename) {
|
||||
assert_return(server, -EINVAL);
|
||||
|
||||
if (filename && !ascii_is_valid(filename))
|
||||
if (filename && (!string_is_safe(filename) || !ascii_is_valid(filename)))
|
||||
return -EINVAL;
|
||||
|
||||
return free_and_strdup(&server->filename, filename);
|
||||
|
||||
@@ -306,7 +306,7 @@ DHCPServer.SendVendorOption, config_parse_dhcp_send_option,
|
||||
DHCPServer.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_server_send_options)
|
||||
DHCPServer.BindToInterface, config_parse_bool, 0, offsetof(Network, dhcp_server_bind_to_interface)
|
||||
DHCPServer.NextServer, config_parse_in_addr_non_null, AF_INET, offsetof(Network, dhcp_server_next_server)
|
||||
DHCPServer.Filename, config_parse_string, 0, offsetof(Network, dhcp_server_filename)
|
||||
DHCPServer.Filename, config_parse_string, CONFIG_PARSE_STRING_SAFE_AND_ASCII, offsetof(Network, dhcp_server_filename)
|
||||
DHCPServerStaticLease.Address, config_parse_dhcp_static_lease_address, 0, 0
|
||||
DHCPServerStaticLease.MACAddress, config_parse_dhcp_static_lease_hwaddr, 0, 0
|
||||
Bridge.Cost, config_parse_uint32, 0, offsetof(Network, cost)
|
||||
|
||||
Reference in New Issue
Block a user