diff options
author | Francesco Giudici <fgiudici@redhat.com> | 2019-09-02 17:30:59 +0200 |
---|---|---|
committer | Francesco Giudici <fgiudici@redhat.com> | 2019-09-13 18:44:32 +0200 |
commit | 86973eae1f86fd7f36e23ade9fe8892efd8c1846 (patch) | |
tree | b13b36ab44f8851bc0aa15b9b9a1871dc6dba129 /src/dhcp/nm-dhcp-nettools.c | |
parent | 3a10c477864ed4d07d0e4c67537b67add52926f0 (diff) | |
download | NetworkManager-86973eae1f86fd7f36e23ade9fe8892efd8c1846.tar.gz |
dhcp: nettools: add utf8 checking on the wpad option
and assert values exported as dhcp options are utf8 compliant
Diffstat (limited to 'src/dhcp/nm-dhcp-nettools.c')
-rw-r--r-- | src/dhcp/nm-dhcp-nettools.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dhcp/nm-dhcp-nettools.c b/src/dhcp/nm-dhcp-nettools.c index 594145a84d..12b14c28ca 100644 --- a/src/dhcp/nm-dhcp-nettools.c +++ b/src/dhcp/nm-dhcp-nettools.c @@ -811,7 +811,7 @@ static void lease_parse_wpad (NDhcp4ClientLease *lease, GHashTable *options) { - nm_auto_free_gstring GString *str = NULL; + gs_free char *wpad = NULL; uint8_t *data; size_t n_data; int r; @@ -820,11 +820,14 @@ lease_parse_wpad (NDhcp4ClientLease *lease, if (r) return; - str = g_string_new_len ((char *)data, n_data); + nm_utils_buf_utf8safe_escape ((char *)data, n_data, 0, &wpad); + if (wpad == NULL) + wpad = g_strndup ((char *)data, n_data); + nm_dhcp_option_add_option (options, _nm_dhcp_option_dhcp4_options, NM_DHCP_OPTION_DHCP4_PRIVATE_PROXY_AUTODISCOVERY, - str->str); + wpad); } static void |