瀏覽代碼

GetDirectoryPath: return NULL, don't crash when no slash

Noted in #634.
pull/635/head
Ahmad Fatoum 6 年之前
父節點
當前提交
85213795d1
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: C3EAC3DE9321D59B
共有 1 個檔案被更改,包括 3 行新增0 行删除
  1. +3
    -0
      src/core.c

+ 3
- 0
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';

Loading…
取消
儲存