gio: fix OOB string access if filename is empty

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-02-16 18:50:17 +04:00
parent d286ea0c57
commit 9f2660fbae

View File

@ -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;