mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 13:50:13 +01:00
libnm: allow nm_utils_hwaddr_valid() of length zero
nm_utils_hwaddr_valid() is used for validating strings. It should not assert against calling it with an empty string "". That is just an invalid hwaddr.
This commit is contained in:
parent
c28b334fdd
commit
4e463df100
1 changed files with 4 additions and 2 deletions
|
|
@ -3827,9 +3827,11 @@ nm_utils_hwaddr_valid (const char *asc, gssize length)
|
|||
if (!hwaddr_aton (asc, buf, length, &l))
|
||||
return FALSE;
|
||||
return length == l;
|
||||
} else if (length == -1) {
|
||||
} else if (length == -1)
|
||||
return !!hwaddr_aton (asc, buf, sizeof (buf), &l);
|
||||
} else
|
||||
else if (length == 0)
|
||||
return FALSE;
|
||||
else
|
||||
g_return_val_if_reached (FALSE);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue