summaryrefslogtreecommitdiff
path: root/src/utils/physfsrwops.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-29 13:07:53 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-29 13:07:53 +0300
commite37bf9dd8764adaf1b83a98b2abfd140efbb3379 (patch)
tree3721874b6f2093a06110b7e22bbd56c97c989956 /src/utils/physfsrwops.cpp
parentf898898204f163ab807e681b4cc4bf2e26ece147 (diff)
downloadmanaverse-e37bf9dd8764adaf1b83a98b2abfd140efbb3379.tar.gz
manaverse-e37bf9dd8764adaf1b83a98b2abfd140efbb3379.tar.bz2
manaverse-e37bf9dd8764adaf1b83a98b2abfd140efbb3379.tar.xz
manaverse-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.cpp6
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 */