gio: check the given child name is not an absolute path

As this would have undesirable consequence.

Quoting Philip Withnall:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2305#note_1294729:

  The documentation never said anything about accepting absolute paths,
  so any code which is relying on that is relying on undocumented
  behaviour. We’re allowed to change that.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2021-10-22 19:54:11 +04:00 committed by Philip Withnall
parent 1df7c2ea80
commit 3a6e8bc887

View File

@ -863,6 +863,7 @@ g_file_get_child (GFile *file,
{
g_return_val_if_fail (G_IS_FILE (file), NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (!g_path_is_absolute (name), NULL);
return g_file_resolve_relative_path (file, name);
}