mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-01 09:08:05 +02:00
ifcfg-rh: fix read-after-free error in reader.c
This commit is contained in:
parent
b7b5599fb3
commit
92b55e709a
1 changed files with 2 additions and 4 deletions
|
|
@ -768,7 +768,6 @@ read_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError
|
|||
}
|
||||
}
|
||||
dest = g_match_info_fetch (match_info, 1);
|
||||
g_match_info_free (match_info);
|
||||
if (!strcmp (dest, "default"))
|
||||
strcpy (dest, "0.0.0.0");
|
||||
if (inet_pton (AF_INET, dest, &ip4_addr) != 1) {
|
||||
|
|
@ -782,6 +781,7 @@ read_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError
|
|||
|
||||
/* Prefix - is optional; 32 if missing */
|
||||
prefix = g_match_info_fetch (match_info, 2);
|
||||
g_match_info_free (match_info);
|
||||
prefix_int = 32;
|
||||
if (prefix) {
|
||||
errno = 0;
|
||||
|
|
@ -793,7 +793,6 @@ read_route_file_legacy (const char *filename, NMSettingIP4Config *s_ip4, GError
|
|||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
nm_ip4_route_set_prefix (route, (guint32) prefix_int);
|
||||
g_free (prefix);
|
||||
|
||||
|
|
@ -1022,7 +1021,6 @@ read_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **erro
|
|||
}
|
||||
}
|
||||
dest = g_match_info_fetch (match_info, 1);
|
||||
g_match_info_free (match_info);
|
||||
if (!strcmp (dest, "default"))
|
||||
strcpy (dest, "::");
|
||||
if (inet_pton (AF_INET6, dest, &ip6_addr) != 1) {
|
||||
|
|
@ -1036,6 +1034,7 @@ read_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **erro
|
|||
|
||||
/* Prefix - is optional; 128 if missing */
|
||||
prefix = g_match_info_fetch (match_info, 2);
|
||||
g_match_info_free (match_info);
|
||||
prefix_int = 128;
|
||||
if (prefix) {
|
||||
errno = 0;
|
||||
|
|
@ -1047,7 +1046,6 @@ read_route6_file (const char *filename, NMSettingIP6Config *s_ip6, GError **erro
|
|||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
nm_ip6_route_set_prefix (route, (guint32) prefix_int);
|
||||
g_free (prefix);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue