From bf8ddafb54cd8ae178a7469f4579691a3f35f709 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Thu, 8 Sep 2016 19:03:22 -0700 Subject: [PATCH] Core: Fix potential overflow openining files --- src/core/directories.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/directories.c b/src/core/directories.c index f95eb80fc..db4ec1b26 100644 --- a/src/core/directories.c +++ b/src/core/directories.c @@ -108,8 +108,8 @@ struct VFile* mDirectorySetOpenPath(struct mDirectorySet* dirs, const char* path } 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); }