mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-25 04:28:30 +00:00
Add security checks when loading data from memory
This commit is contained in:
12
src/text.c
12
src/text.c
@@ -340,10 +340,14 @@ Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCou
|
||||
unsigned int fileSize = 0;
|
||||
unsigned char *fileData = LoadFileData(fileName, &fileSize);
|
||||
|
||||
// Loading font from memory data
|
||||
font = LoadFontFromMemory(GetFileExtension(fileName), fileData, fileSize, fontSize, fontChars, charsCount);
|
||||
|
||||
RL_FREE(fileData);
|
||||
if (fileData != NULL)
|
||||
{
|
||||
// Loading font from memory data
|
||||
font = LoadFontFromMemory(GetFileExtension(fileName), fileData, fileSize, fontSize, fontChars, charsCount);
|
||||
|
||||
RL_FREE(fileData);
|
||||
}
|
||||
else font = GetFontDefault();
|
||||
|
||||
return font;
|
||||
}
|
||||
|
Reference in New Issue
Block a user