mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
gkeyfilesettingsbackend: Fix basename handling when group is unset
Fix an effective regression in commit7781a9cbd2
, which happens when `convert_path()` is called with a `key` which contains no slashes. In that case, the `key` is entirely the `basename`. Prior to commit7781a9cb
, the code worked through a fluke of `i == -1` cancelling out with the various additions in the `g_memdup()` call, and effectively resulting in `g_strdup (key)`. Spotted by Guido Berhoerster. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
206ebfbff6
commit
9d27c57f70
@ -188,7 +188,12 @@ convert_path (GKeyfileSettingsBackend *kfsb,
|
||||
}
|
||||
|
||||
if (basename)
|
||||
*basename = g_memdup2 (last_slash + 1, key_len - (last_slash - key));
|
||||
{
|
||||
if (last_slash != NULL)
|
||||
*basename = g_memdup2 (last_slash + 1, key_len - (last_slash - key));
|
||||
else
|
||||
*basename = g_strdup (key);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user