From 8e2fe8a3f74ba4071d8e821f7f26deecbc33846e Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Wed, 11 Nov 2015 12:18:15 +0000 Subject: [PATCH] Fix: Handle mount=NULL in config_find_mount() correctly. --- src/cfgfile.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cfgfile.c b/src/cfgfile.c index a140576a..e613dc0b 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -2277,6 +2277,10 @@ mount_proxy *config_find_mount (ice_config_t *config, { mount_proxy *mountinfo = config->mounts; + /* invalid args */ + if (!mount && type != MOUNT_TYPE_DEFAULT) + return NULL; + for (; mountinfo; mountinfo = mountinfo->next) { if (mountinfo->mounttype != type) continue; @@ -2288,7 +2292,7 @@ mount_proxy *config_find_mount (ice_config_t *config, if (strcmp(mountinfo->mountname, mount) == 0) break; } else if (mountinfo->mounttype == MOUNT_TYPE_DEFAULT) { - if (!mountinfo->mountname) + if (!mount || !mountinfo->mountname) break; #ifndef _WIN32 if (fnmatch(mountinfo->mountname, mount, FNM_PATHNAME) == 0)