]> git.cameronkatri.com Git - mandoc.git/commitdiff
Do not treat PATH_INFO as a complete path if it doesn't contain
authorIngo Schwarze <schwarze@openbsd.org>
Sat, 9 Jul 2016 19:58:36 +0000 (19:58 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Sat, 9 Jul 2016 19:58:36 +0000 (19:58 +0000)
a manpath.  For example, this makes http://man.openbsd.org/mandoc
work as expected.
Bug reported by tb@, reminded by Svyatoslav Mishyn.

cgi.c

diff --git a/cgi.c b/cgi.c
index 81040abff42b4cf3195235bbb0732e424349258a..1e77a20b585db355b8bc4c0453faf443d4d5185f 100644 (file)
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/*     $Id: cgi.c,v 1.132 2016/05/28 13:40:48 schwarze Exp $ */
+/*     $Id: cgi.c,v 1.133 2016/07/09 19:58:36 schwarze Exp $ */
 /*
  * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@usta.de>
@@ -1026,7 +1026,7 @@ main(void)
 
        if (*path != '\0') {
                parse_path_info(&req, path);
-               if (access(path, F_OK) == -1)
+               if (req.q.manpath == NULL || access(path, F_OK) == -1)
                        path = "";
        } else if ((querystring = getenv("QUERY_STRING")) != NULL)
                parse_query_string(&req, querystring);