mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 16:40:16 +01:00
dhcp: escape control characters in DHCP options
Control characters (DEL (=127) or those below 32) could cause undesired
effects when a client displays or parses DHCP options. Escape them.
(cherry picked from commit 0c10e4f8b6)
This commit is contained in:
parent
8481470557
commit
5f85f1631b
2 changed files with 8 additions and 2 deletions
|
|
@ -694,7 +694,10 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
|
|||
|
||||
/* https://tools.ietf.org/html/rfc2132#section-8.1 */
|
||||
|
||||
v_str = nm_utils_buf_utf8safe_escape((char *) l_data, l_data_len, 0, &to_free);
|
||||
v_str = nm_utils_buf_utf8safe_escape((char *) l_data,
|
||||
l_data_len,
|
||||
NM_UTILS_STR_UTF8_SAFE_FLAG_ESCAPE_CTRL,
|
||||
&to_free);
|
||||
|
||||
nm_dhcp_option_add_option(options, AF_INET, NM_DHCP_OPTION_DHCP4_NIS_DOMAIN, v_str ?: "");
|
||||
nm_ip4_config_set_nis_domain(ip4_config, v_str ?: "");
|
||||
|
|
|
|||
|
|
@ -404,7 +404,10 @@ nm_dhcp_option_add_option_utf8safe_escape(GHashTable * options,
|
|||
gs_free char *to_free = NULL;
|
||||
const char * escaped;
|
||||
|
||||
escaped = nm_utils_buf_utf8safe_escape((char *) data, n_data, 0, &to_free);
|
||||
escaped = nm_utils_buf_utf8safe_escape((char *) data,
|
||||
n_data,
|
||||
NM_UTILS_STR_UTF8_SAFE_FLAG_ESCAPE_CTRL,
|
||||
&to_free);
|
||||
nm_dhcp_option_add_option(options, addr_family, option, escaped ?: "");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue