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.
This commit is contained in:
Thomas Haller
2020-04-01 12:50:53 +02:00
parent 3477d764d3
commit d506823d4f

View File

@@ -719,7 +719,7 @@ reader_parse_vlan (Reader *reader, 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)