diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp index 5639bd12..1ffe941e 100644 --- a/src/audio/oal/stream.cpp +++ b/src/audio/oal/stream.cpp @@ -205,7 +205,7 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF #if !defined(_WIN32) FILE *test = fopen(filename, "r"); if (!test) { - char *r = (char*)alloca(strlen(filename) + 2); + char *r = (char*)alloca(strlen(filename) + 4); if (casepath(filename, r)) { strcpy(m_aFilename, r); diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp index 4d6bcdab..073ba909 100644 --- a/src/core/CdStreamPosix.cpp +++ b/src/core/CdStreamPosix.cpp @@ -189,7 +189,7 @@ GetGTA3ImgSize(void) realpath(gImgNames[0], path); if (stat(path, &statbuf) == -1) { // Try case-insensitivity - char *r = (char*)alloca(strlen(gImgNames[0]) + 2); + char *r = (char*)alloca(strlen(gImgNames[0]) + 4); if (casepath(gImgNames[0], r)) { realpath(r, path); @@ -460,7 +460,7 @@ CdStreamAddImage(char const *path) // Fix case sensitivity and backslashes. if (gImgFiles[gNumImages] == -1) { - char *r = (char*)alloca(strlen(path) + 2); + char *r = (char*)alloca(strlen(path) + 4); if (casepath(path, r)) { gImgFiles[gNumImages] = open(r, _gdwCdStreamFlags); diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp index 8dbc6894..618874fa 100644 --- a/src/core/FileMgr.cpp +++ b/src/core/FileMgr.cpp @@ -37,7 +37,7 @@ static myFILE myfiles[NUMFILES]; // Case-insensitivity on linux (from https://github.com/OneSadCookie/fcaseopen) void mychdir(char const *path) { - char *r = (char*)alloca(strlen(path) + 2); + char *r = (char*)alloca(strlen(path) + 4); if (casepath(path, r)) { chdir(r); @@ -88,7 +88,7 @@ found: // Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/) #if !defined(_WIN32) if (!myfiles[fd].file) { - char *r = (char*)alloca(strlen(newPath) + 2); + char *r = (char*)alloca(strlen(newPath) + 4); if (casepath(newPath, r)) { myfiles[fd].file = fopen(r, realmode); diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp index 6524e87c..d4417a7f 100644 --- a/src/fakerw/fake.cpp +++ b/src/fakerw/fake.cpp @@ -379,7 +379,7 @@ RwStream *RwStreamOpen(RwStreamType type, RwStreamAccessType accessType, const v FILE* first = fopen((char*)pData, "r"); char *r; if (!first) { - r = (char*)alloca(strlen((char*)pData) + 2); + r = (char*)alloca(strlen((char*)pData) + 4); // Use default path(and pass error handling to librw) if we can't find any match if (!casepath((char*)pData, r)) r = (char*)pData; @@ -862,7 +862,7 @@ RtBMPImageWrite(RwImage *image, const RwChar *imageName) char *r = nil; FILE *valid = fopen((char *)imageName, "r"); if(!valid) { - char *r = (char *)alloca(strlen((char *)imageName) + 2); + char *r = (char *)alloca(strlen((char *)imageName) + 4); // Use default path(and pass error handling to librw) if we can't find any match if(!casepath((char *)imageName, r)) r = (char *)imageName; } else @@ -880,7 +880,7 @@ RtBMPImageRead(const RwChar *imageName) char *r = nil; FILE *valid = fopen((char *)imageName, "r"); if(!valid) { - r = (char *)alloca(strlen((char *)imageName) + 2); + r = (char *)alloca(strlen((char *)imageName) + 4); // Use default path(and pass error handling to librw) if we can't find any match if(!casepath((char *)imageName, r)) r = (char *)imageName; } else