summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-10-08 19:45:00 +0200
committerJo-Philipp Wich <jo@mein.io>2016-10-25 16:32:50 +0200
commit577c20c5f780a241d526b16345cf42ea81b675ab (patch)
tree1c5601c22ebdfc0147474db064a3d7d0a512c682
parentc0b5444b533e7177394ceaa247de4495307f72d6 (diff)
cgi: allow conf.cgi_docroot_path to be NULL
The check_cgi_path() function would segfault if we ever support running uhttpd without any CGI prefix. Add a check to prevent running uh_patch_match() when the prefix is unset. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
-rw-r--r--cgi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cgi.c b/cgi.c
index dc302a9..0ffb130 100644
--- a/cgi.c
+++ b/cgi.c
@@ -104,7 +104,11 @@ static bool check_cgi_path(struct path_info *pi, const char *url)
}
pi->ip = NULL;
- return uh_path_match(conf.cgi_docroot_path, pi->phys);
+
+ if (conf.cgi_docroot_path)
+ return uh_path_match(conf.cgi_docroot_path, pi->phys);
+
+ return false;
}
struct dispatch_handler cgi_dispatch = {