diff options
| author | Ahmad Fatoum <[email protected]> | 2018-08-25 09:27:41 +0200 |
|---|---|---|
| committer | Ahmad Fatoum <[email protected]> | 2018-08-25 09:27:41 +0200 |
| commit | 85213795d162ff03e48523afb854d6d6d17f27d4 (patch) | |
| tree | 13bf50e0f9f7119a0346a613ffd9d8121766af5e | |
| parent | 5dda105a79c5d258a3c1ae48bb35ce817540b632 (diff) | |
| download | raylib-85213795d162ff03e48523afb854d6d6d17f27d4.tar.gz raylib-85213795d162ff03e48523afb854d6d6d17f27d4.zip | |
GetDirectoryPath: return NULL, don't crash when no slash
Noted in #634.
| -rw-r--r-- | src/core.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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'; |
