mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 16:20:09 +01:00
keyfile: handle invalid integer list in keyfile reader get_bytes()
nm_keyfile_plugin_kf_get_integer_list() should always set
@length to zero when returning no integer list. So, this
is probably correct. Still, just to be explicit, anticipate
and handle a missing @tmp_list.
(cherry picked from commit f430774ca0)
This commit is contained in:
parent
d655b80dbe
commit
57c2c844f1
1 changed files with 8 additions and 0 deletions
|
|
@ -618,6 +618,9 @@ get_bytes (GKeyFile *keyfile,
|
|||
gsize length;
|
||||
int i;
|
||||
|
||||
if (!nm_keyfile_plugin_kf_has_key (keyfile, setting_name, key, NULL))
|
||||
return NULL;
|
||||
|
||||
/* New format: just a string
|
||||
* Old format: integer list; e.g. 11;25;38;
|
||||
*/
|
||||
|
|
@ -647,6 +650,11 @@ get_bytes (GKeyFile *keyfile,
|
|||
if (!array) {
|
||||
/* Old format; list of ints */
|
||||
tmp_list = nm_keyfile_plugin_kf_get_integer_list (keyfile, setting_name, key, &length, NULL);
|
||||
if (!tmp_list) {
|
||||
nm_log_warn (LOGD_SETTINGS, "%s: %s / %s ignoring invalid binary property",
|
||||
__func__, setting_name, key);
|
||||
return NULL;
|
||||
}
|
||||
array = g_byte_array_sized_new (length);
|
||||
for (i = 0; i < length; i++) {
|
||||
int val = tmp_list[i];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue