keyfile: minor cleanup handling error in read_array_of_uint()

Why "if (length > G_MAXUINT)"? This is never going to hit. Also,
we probably should actual missing keys handle differently from
empty lists. If @error is set, return without setting the property.
This commit is contained in:
Thomas Haller 2020-04-15 22:37:10 +02:00
parent 8f46425b11
commit 2cf31bfef0

View file

@ -167,9 +167,10 @@ read_array_of_uint (GKeyFile *file,
gsize length;
gsize i;
gs_free int *tmp = NULL;
gs_free_error GError *error = NULL;
tmp = nm_keyfile_plugin_kf_get_integer_list (file, nm_setting_get_name (setting), key, &length, NULL);
if (length > G_MAXUINT)
tmp = nm_keyfile_plugin_kf_get_integer_list (file, nm_setting_get_name (setting), key, &length, &error);
if (error)
return;
array = g_array_sized_new (FALSE, FALSE, sizeof (guint), length);