summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Oliver Stöneberg <firewave@users.noreply.github.com>2014-05-14 09:58:56 +0000
committer Oliver Stöneberg <firewave@users.noreply.github.com>2014-05-14 09:58:56 +0000
commit7df2680c960e3289ee27b342cb9983e710cd8fb4 (patch)
tree3c22cb2a8216c5fd248faa60b68d8028de5f7911 /src/lib
parent2836bb12bce71998c43a6455339e22b249a55410 (diff)
return an error when trying to use a .7z file with zippath - for now (nw)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/zippath.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/util/zippath.c b/src/lib/util/zippath.c
index 69eea2fa20b..fb5b4eb8204 100644
--- a/src/lib/util/zippath.c
+++ b/src/lib/util/zippath.c
@@ -59,6 +59,7 @@ public:
static const zip_file_header *zippath_find_sub_path(zip_file *zipfile, const char *subpath, osd_dir_entry_type *type);
static int is_zip_file(const char *path);
static int is_zip_file_separator(char c);
+static int is_7z_file(const char *path);
/***************************************************************************
@@ -298,6 +299,11 @@ file_error zippath_fopen(const char *filename, UINT32 openflags, core_file *&fil
goto done;
}
}
+ else if (is_7z_file(mainpath))
+ {
+ filerr = FILERR_INVALID_DATA;
+ goto done;
+ }
if (subpath.len() == 0)
filerr = core_fopen(filename, openflags, &file);
@@ -379,6 +385,18 @@ static int is_root(const char *path)
/*-------------------------------------------------
+ is_7z_file - tests to see if this file is a
+ 7-zip file
+-------------------------------------------------*/
+
+static int is_7z_file(const char *path)
+{
+ const char *s = strrchr(path, '.');
+ return (s != NULL) && !core_stricmp(s, ".7z");
+}
+
+
+/*-------------------------------------------------
is_zip_file - tests to see if this file is a
ZIP file
-------------------------------------------------*/