From: Jo-Philipp Wich Date: Thu, 8 Oct 2015 17:45:00 +0000 (+0200) Subject: cgi: allow conf.cgi_docroot_path to be NULL X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=577c20c5f780a241d526b16345cf42ea81b675ab;p=oweals%2Fuhttpd.git 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 --- 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 = {