initrd: fix setting VLan ID in reader_parse_vlan()

g_ascii_strtoull() returns a guint64, which is very wrong to directly pass
to the variadic argument list of g_object_set(). We expect a guint there
and need to cast.

While at it, use _nm_utils_ascii_str_to_int64() to parse and validate the input.

(cherry picked from commit d506823d4f)
(cherry picked from commit 24177569c1)
This commit is contained in:
Thomas Haller 2020-04-01 12:50:53 +02:00
parent 477c6c3e70
commit 0a10468d79

View file

@ -640,7 +640,7 @@ parse_vlan (GHashTable *connections, char *argument)
s_vlan = nm_connection_get_setting_vlan (connection);
g_object_set (s_vlan,
NM_SETTING_VLAN_PARENT, phy,
NM_SETTING_VLAN_ID, g_ascii_strtoull (vlanid, NULL, 10),
NM_SETTING_VLAN_ID, (guint) _nm_utils_ascii_str_to_int64 (vlanid, 10, 0, G_MAXUINT, G_MAXUINT),
NULL);
if (argument && *argument)