diff options
| author | Ray <[email protected]> | 2022-06-18 20:44:15 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2022-06-18 20:44:15 +0200 |
| commit | 5426262ae6461362ec7a61d72a436db4a5833745 (patch) | |
| tree | cf0c579e83171c164a96e4f69663c37536e716f2 | |
| parent | 8fe6bfabbf91913fcca10ab12d23fcbde568f7b1 (diff) | |
| download | raylib-5426262ae6461362ec7a61d72a436db4a5833745.tar.gz raylib-5426262ae6461362ec7a61d72a436db4a5833745.zip | |
REVIEWED: `IsFileExtension()` #2530
Max file extension size set to 16
| -rw-r--r-- | src/rcore.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rcore.c b/src/rcore.c index f5104f0a..fe791482 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -2850,6 +2850,8 @@ bool FileExists(const char *fileName) // NOTE: Extensions checking is not case-sensitive bool IsFileExtension(const char *fileName, const char *ext) { + #define MAX_FILE_EXTENSION_SIZE 16 + bool result = false; const char *fileExt = GetFileExtension(fileName); @@ -2857,10 +2859,10 @@ bool IsFileExtension(const char *fileName, const char *ext) { #if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_TEXT_MANIPULATION) int extCount = 0; - const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext + const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext - char fileExtLower[16] = { 0 }; - strcpy(fileExtLower, TextToLower(fileExt)); // WARNING: Module required: rtext + char fileExtLower[MAX_FILE_EXTENSION_SIZE] = { 0 }; + strncpy(fileExtLower, TextToLower(fileExt),MAX_FILE_EXTENSION_SIZE); // WARNING: Module required: rtext for (int i = 0; i < extCount; i++) { |
