mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 17:00:40 +01:00
core: discard non UTF-8 search domains
Domains are exported via D-Bus and so they must be valid UTF-8. RFC 1035 specifies that domain labels can contain any 8 bit values, but also recommends that they follow the "preferred syntax" which only allows letters, digits and hypens. Don't introduce a strict validation of the preferred syntax, but at least discard non UTF-8 search domains, as they will cause assertion failures later when they are sent over D-Bus.
This commit is contained in:
parent
472a7b48e8
commit
14a521ac9b
1 changed files with 3 additions and 0 deletions
|
|
@ -1419,6 +1419,9 @@ _check_and_add_domain(GPtrArray **p_arr, const char *domain)
|
|||
if (domain[0] == '.' || strstr(domain, ".."))
|
||||
return FALSE;
|
||||
|
||||
if (!g_utf8_validate(domain, -1, NULL))
|
||||
return FALSE;
|
||||
|
||||
len = strlen(domain);
|
||||
if (domain[len - 1] == '.') {
|
||||
copy = g_strndup(domain, len - 1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue