Add security checks when loading data from memory
This commit is contained in:
parent
c5c156d65e
commit
43d82c1f21
3 changed files with 23 additions and 13 deletions
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue