diff options
author | Pablo Barciela <[email protected]> | 2019-03-22 12:34:57 +0100 |
---|---|---|
committer | Pablo Barciela <[email protected]> | 2019-04-02 00:59:43 +0200 |
commit | 1f5427909b389ed49d9a445155cd73ec25238b63 (patch) | |
tree | 0b4a597e6dfd23fda8c3c31b57c3dbb3c232bd02 | |
parent | b7407f9a455b5f481b18ad90e89ad9b0351d864d (diff) | |
download | engrampa-1f5427909b389ed49d9a445155cd73ec25238b63.tar.bz2 engrampa-1f5427909b389ed49d9a445155cd73ec25238b63.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)
^~~~~~~~~~~~~~~~~~~~~
-rw-r--r-- | src/file-utils.c | 2 |
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; |