mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-13 00:00:34 +01:00
keyfile: don't assert when parsing invalid prefix
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
1e8b681d4f
commit
f2097ca482
1 changed files with 10 additions and 8 deletions
|
|
@ -324,15 +324,17 @@ read_one_ip_address_or_route (GKeyFile *file,
|
|||
}
|
||||
}
|
||||
|
||||
#define DEFAULT_PREFIX(for_route, for_ipv6) ( (for_route) ? ( (for_ipv6) ? 128 : 24 ) : ( (for_ipv6) ? 64 : 24 ) )
|
||||
|
||||
/* parse plen, fallback to defaults */
|
||||
if (plen_str)
|
||||
g_return_val_if_fail (get_one_int (plen_str, ipv6 ? 128 : 32,
|
||||
key_name, &plen), NULL);
|
||||
else {
|
||||
if (route)
|
||||
plen = ipv6 ? 128 : 24;
|
||||
else
|
||||
plen = ipv6 ? 64 : 24;
|
||||
if (plen_str) {
|
||||
if (!get_one_int (plen_str, ipv6 ? 128 : 32, key_name, &plen)) {
|
||||
plen = DEFAULT_PREFIX (route, ipv6);
|
||||
nm_log_warn (LOGD_SETTINGS, "keyfile: invalid prefix length '%s' in '%s.%s', defaulting to %d",
|
||||
plen_str, setting_name, key_name, plen);
|
||||
}
|
||||
} else {
|
||||
plen = DEFAULT_PREFIX (route, ipv6);
|
||||
nm_log_warn (LOGD_SETTINGS, "keyfile: Missing prefix length in '%s.%s', defaulting to %d",
|
||||
setting_name, key_name, plen);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue