Core: Add sanity check for mDirectorySetOpenSuffix

This commit is contained in:
Vicki Pfau 2024-10-04 17:17:47 -07:00
parent 541ed9606c
commit 5fb7c5e3ee
1 changed files with 3 additions and 0 deletions

View File

@ -110,6 +110,9 @@ struct VFile* mDirectorySetOpenPath(struct mDirectorySet* dirs, const char* path
}
struct VFile* mDirectorySetOpenSuffix(struct mDirectorySet* dirs, struct VDir* dir, const char* suffix, int mode) {
if (!dir) {
return NULL;
}
char name[PATH_MAX + 1] = "";
snprintf(name, sizeof(name) - 1, "%s%s", dirs->baseName, suffix);
return dir->openFile(dir, name, mode);