From 577c20c5f780a241d526b16345cf42ea81b675ab Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 8 Oct 2015 19:45:00 +0200 Subject: [PATCH] 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 --- cgi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 = { -- 2.11.0