summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2019-03-22 12:34:57 +0100
committerZenWalker <[email protected]>2019-04-02 00:58:08 +0200
commitbe2355c8ece8ad7f50ab80185e98b865fa534cf4 (patch)
tree1331a65fdcd218e856ea3528fc114fdeb35b83ed /src
parentbf0478b2b950b49cca1fda1a97bafc72c942554f (diff)
downloadengrampa-be2355c8ece8ad7f50ab80185e98b865fa534cf4.tar.bz2
engrampa-be2355c8ece8ad7f50ab80185e98b865fa534cf4.tar.xz
file-utils: avoid out of bound memory access
Fixes Clang static analyzer warning: file-utils.c:453:6: warning: Out of bound memory access (access exceeds upper limit of memory block) if (file_name [last_char] == G_DIR_SEPARATOR) ^~~~~~~~~~~~~~~~~~~~~
Diffstat (limited to 'src')
-rw-r--r--src/file-utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/file-utils.c b/src/file-utils.c
index e3e1fc3..5535566 100644
--- a/src/file-utils.c
+++ b/src/file-utils.c
@@ -445,7 +445,7 @@ const gchar* file_name_from_path(const gchar *file_name)
if (file_name == NULL)
return NULL;
- if (file_name[0] == '\0')
+ if ((file_name[0] == '\0') || (strlen (file_name) == 0))
return "";
last_char = strlen (file_name) - 1;