Core: Fix potential overflow openining files
Jeffrey Pfau jeffrey@endrift.com
Thu, 08 Sep 2016 19:03:22 -0700
1 files changed,
2 insertions(+),
2 deletions(-)
jump to
M
src/core/directories.c
→
src/core/directories.c
@@ -108,8 +108,8 @@ return file;
} struct VFile* mDirectorySetOpenSuffix(struct mDirectorySet* dirs, struct VDir* dir, const char* suffix, int mode) { - char name[PATH_MAX]; - snprintf(name, sizeof(name), "%s%s", dirs->baseName, suffix); + char name[PATH_MAX + 1] = ""; + snprintf(name, sizeof(name) - 1, "%s%s", dirs->baseName, suffix); return dir->openFile(dir, name, mode); }