mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 12:00:17 +01:00
dhcp: nettools: add utf8 checking on the wpad option
and assert values exported as dhcp options are utf8 compliant
This commit is contained in:
parent
3a10c47786
commit
86973eae1f
2 changed files with 7 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@ nm_dhcp_option_take_option (GHashTable *options,
|
|||
nm_assert (options);
|
||||
nm_assert (requests);
|
||||
nm_assert (value);
|
||||
nm_assert (g_utf8_validate (value, -1, NULL));
|
||||
|
||||
g_hash_table_insert (options,
|
||||
(gpointer) nm_dhcp_option_request_string (requests, option),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue