From 1191f425b33a517ebb38d9b39cd0cbcda42b0427 Mon Sep 17 00:00:00 2001 From: Misa Date: Sun, 18 Apr 2021 10:41:19 -0700 Subject: [PATCH] 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. --- desktop_version/src/FileSystemUtils.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index 8c538a7c..304e7322 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -451,6 +451,11 @@ void FILESYSTEM_loadFileToMemory( PHYSFS_sint64 length; PHYSFS_sint64 success; + if (name == NULL || mem == NULL) + { + goto fail; + } + 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