summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index 81ca2f58..ce510406 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1374,6 +1374,9 @@ const char *GetDirectoryPath(const char *fileName)
memset(filePath, 0, 256);
lastSlash = strprbrk(fileName, "\\/");
+ if (!lastSlash)
+ return NULL;
+
strncpy(filePath, fileName, strlen(fileName) - (strlen(lastSlash) - 1));
filePath[strlen(fileName) - strlen(lastSlash)] = '\0';