[glib: 1/11] gio: fix OOB string access if filename is empty
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/11] gio: fix OOB string access if filename is empty
- Date: Thu, 17 Mar 2022 15:14:17 +0000 (UTC)
commit 9f2660fbaefff146cbd5b4bfc885b7e3f47e1626
Author: Marc-André Lureau <marcandre lureau redhat com>
Date: Wed Feb 16 18:50:17 2022 +0400
gio: fix OOB string access if filename is empty
Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]