aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorRoland Knall <rknall@gmail.com>2019-08-05 10:04:22 +0200
committerRoland Knall <rknall@gmail.com>2019-08-05 13:47:11 +0000
commit5c678288bcbf4fe870a1582cf31eed6eaa17841c (patch)
treed9b3391ea0408a720fb4d9428a163bdf4cb8799a /wsutil
parentb31d1168f79164afac7b18babe7a3de6e7c17490 (diff)
Qt: Check filename before import
Before the unzipped files are being copied from the temp directory, they are checked against the stored list of profile names, to ensure, that only allowed files are being imported. Also ensures, that no empty directory exists for the skipped one Bug: 15969 Change-Id: I6ae8c9fb5f63d089d42fc0ef18dbe84baec515a2 Reviewed-on: https://code.wireshark.org/review/34184 Petri-Dish: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/filesystem.c6
-rw-r--r--wsutil/filesystem.h5
2 files changed, 11 insertions, 0 deletions
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index f2a05e3b98..72b3c9bf94 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -1676,6 +1676,12 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
return ret;
}
+const GHashTable *
+allowed_profile_filenames(void)
+{
+ return profile_files;
+}
+
int
create_persconffile_dir(char **pf_dir_path_return)
{
diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h
index e00794899e..441586eab3 100644
--- a/wsutil/filesystem.h
+++ b/wsutil/filesystem.h
@@ -162,6 +162,11 @@ WS_DLL_PUBLIC int create_persconffile_profile(const char *profilename,
char **pf_dir_path_return);
/*
+ * Returns the list of known profile config filesnames
+ */
+WS_DLL_PUBLIC const GHashTable * allowed_profile_filenames(void);
+
+/*
* Delete the directory for the given configuration profile.
* If we attempted to delete it, and failed, return -1 and
* set "*pf_dir_path_return" to the pathname of the directory we failed