From 3a6e8bc8876e149c36b6b14c6a25a718edb581ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 22 Oct 2021 19:54:11 +0400 Subject: [PATCH] gio: check the given child name is not an absolute path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gio/gfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gio/gfile.c b/gio/gfile.c index d1eac65fe..08691900f 100644 --- a/gio/gfile.c +++ b/gio/gfile.c @@ -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); }