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.

(cherry picked from commit 2cf31bfef0)
(cherry picked from commit f00d306ae7)
(cherry picked from commit cd33ea1fc0)
(cherry picked from commit e1acac6311)
This commit is contained in:
Thomas Haller 2020-04-15 22:37:10 +02:00
parent 815f48152f
commit 072ef0c1e4

View file

@ -182,9 +182,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);