From e4096ac8efe9be7e191067bab520ba1be8249c30 Mon Sep 17 00:00:00 2001
From: Christopher Zimmermann <chrisz@cvs.openbsd.org>
Date: Wed, 13 Aug 2014 08:08:56 +0000
Subject: fix early loop termination in httpd path_info() without this fix
 httpd always put at least the first path component in SCRIPT_NAME even when
 it did not exist. Now for completely non-existant paths everything goes into
 PATH_INFO.

---
 usr.sbin/httpd/httpd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'usr.sbin')

diff --git a/usr.sbin/httpd/httpd.c b/usr.sbin/httpd/httpd.c
index 220f5375a68..d5ca6e4067c 100644
--- a/usr.sbin/httpd/httpd.c
+++ b/usr.sbin/httpd/httpd.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: httpd.c,v 1.17 2014/08/05 15:36:59 reyk Exp $	*/
+/*	$OpenBSD: httpd.c,v 1.18 2014/08/13 08:08:55 chrisz Exp $	*/
 
 /*
  * Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
@@ -593,7 +593,7 @@ path_info(char *name)
 	start = path;
 	end = start + strlen(path);
 
-	for (p = end; p > start; p--) {
+	for (p = end; p >= start; p--) {
 		if (*p != '/')
 			continue;
 		if (stat(path, &st) == 0)
-- 
cgit v1.2.3