From e37bf9dd8764adaf1b83a98b2abfd140efbb3379 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 29 Dec 2012 13:07:53 +0300 Subject: Add checks for incorrect path before calling unsafe physfs functions. --- src/utils/physfsrwops.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/physfsrwops.cpp b/src/utils/physfsrwops.cpp index fdf9bc957..e755ea353 100644 --- a/src/utils/physfsrwops.cpp +++ b/src/utils/physfsrwops.cpp @@ -177,16 +177,22 @@ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle) SDL_RWops *PHYSFSRWOPS_openRead(const char *fname) { + if (!fname || !*fname) + return nullptr; return create_rwops(PHYSFS_openRead(fname)); } /* PHYSFSRWOPS_openRead */ SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname) { + if (!fname || !*fname) + return nullptr; return create_rwops(PHYSFS_openWrite(fname)); } /* PHYSFSRWOPS_openWrite */ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname) { + if (!fname || !*fname) + return nullptr; return create_rwops(PHYSFS_openAppend(fname)); } /* PHYSFSRWOPS_openAppend */ -- cgit v1.2.3-60-g2f50