From 0f85eefb8b3601d2b5d23b36c09a0184f6b18d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 16 Feb 2022 18:50:17 +0400 Subject: [PATCH] gio: fix OOB string access if filename is empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- gio/gcontenttype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c index 3e5b841ab..3c9522bc6 100644 --- a/gio/gcontenttype.c +++ b/gio/gcontenttype.c @@ -780,7 +780,7 @@ g_content_type_guess (const gchar *filename, if (filename) { i = strlen (filename); - if (filename[i - 1] == '/') + if (i > 0 && filename[i - 1] == '/') { name_mimetypes[0] = "inode/directory"; name_mimetypes[1] = NULL;