keyfile: fix comparison in nms_keyfile_nmmeta_read()

"uuid" is returned from nms_keyfile_nmmeta_check_filename(),
and contains "$UUID.nmmeta". We must compare only the first
"uuid_len" bytes.

Fixes: 064544cc07 ('settings: support storing "shadowed-storage" to .nmmeta files')
This commit is contained in:
Thomas Haller 2021-06-02 09:33:35 +02:00
parent 25f4d23e13
commit 7e8e6836e0
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -137,7 +137,11 @@ nms_keyfile_nmmeta_read(const char * dirname,
NMMETA_KF_GROUP_NAME_NMMETA,
NMMETA_KF_KEY_NAME_NMMETA_UUID,
NULL);
if (!nm_streq0(v_uuid, uuid))
if (!v_uuid)
return FALSE;
if (strncmp(v_uuid, uuid, uuid_len) != 0)
return FALSE;
if (v_uuid[uuid_len] != '\0')
return FALSE;
loaded_path = g_key_file_get_string(kf,