diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-29 13:07:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-29 13:07:53 +0300 |
commit | e37bf9dd8764adaf1b83a98b2abfd140efbb3379 (patch) | |
tree | 3721874b6f2093a06110b7e22bbd56c97c989956 /src/utils/physfsrwops.cpp | |
parent | f898898204f163ab807e681b4cc4bf2e26ece147 (diff) | |
download | mv-e37bf9dd8764adaf1b83a98b2abfd140efbb3379.tar.gz mv-e37bf9dd8764adaf1b83a98b2abfd140efbb3379.tar.bz2 mv-e37bf9dd8764adaf1b83a98b2abfd140efbb3379.tar.xz mv-e37bf9dd8764adaf1b83a98b2abfd140efbb3379.zip |
Add checks for incorrect path before calling unsafe physfs functions.
Diffstat (limited to 'src/utils/physfsrwops.cpp')
-rw-r--r-- | src/utils/physfsrwops.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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 */ |