dhcp/nettools: fix crash with empty DHCP option 40 (NIS domain name)

nm_utils_buf_utf8safe_escape() returns NULL for an empty string.

Fixes: 6c8a9e8bd6 ('dhcp/nettools: validate nis-domain option (40) differently')
This commit is contained in:
Thomas Haller 2021-05-21 12:42:49 +02:00
parent bf9fab47ad
commit 2d0ac5f5fe
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -696,8 +696,8 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
v_str = nm_utils_buf_utf8safe_escape((char *) l_data, l_data_len, 0, &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);
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 ?: "");
}
lease_parse_address_list(lease, ip4_config, NM_DHCP_OPTION_DHCP4_NIS_SERVERS, options, &sbuf);