mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-16 14:40:36 +01:00
shared: check for valid UTF-8 in nm_utils_ifname_valid()
The interface name might come from the command line or from a filename
(like during nm_vpn_wireguard_import()). It's not clear that this
is valid UTF-8. Asserting against that requires the caller to ensure
that the encoding is valid. That is cumbersome, especially since we anyway
check. Just report a regular error.
(cherry picked from commit 82fb8b00b4)
This commit is contained in:
parent
88d0d80d09
commit
9bbb021b4f
1 changed files with 5 additions and 1 deletions
|
|
@ -4069,7 +4069,11 @@ nm_utils_ifname_valid (const char* name,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (g_utf8_validate (name, -1, NULL), FALSE);
|
||||
if (!g_utf8_validate (name, -1, NULL)) {
|
||||
g_set_error_literal (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
|
||||
_("interface name must be UTF-8 encoded"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case NMU_IFACE_KERNEL:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue