1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Add NULL checks to FILESYSTEM_loadFileToMemory()

FILESYSTEM_loadFileToMemory() dereferenced pointers without checking if
they were valid... I don't know of any cases where they could have been
NULL, but better safe than sorry.
This commit is contained in:
Misa 2021-04-18 10:41:19 -07:00 committed by Ethan Lee
parent 3ebdc1da89
commit 1191f425b3

View file

@ -451,6 +451,11 @@ void FILESYSTEM_loadFileToMemory(
PHYSFS_sint64 length; PHYSFS_sint64 length;
PHYSFS_sint64 success; PHYSFS_sint64 success;
if (name == NULL || mem == NULL)
{
goto fail;
}
if (SDL_strcmp(name, "levels/special/stdin.vvvvvv") == 0) if (SDL_strcmp(name, "levels/special/stdin.vvvvvv") == 0)
{ {
// this isn't *technically* necessary when piping directly from a file, but checking for that is annoying // this isn't *technically* necessary when piping directly from a file, but checking for that is annoying