$NetBSD: patch-ac,v 1.9 2008/03/07 18:17:26 mrg Exp $

Index: bozohttpd.c
===================================================================
RCS file: /home/cvs/bozohttpd/bozohttpd.c,v
retrieving revision 1.140
diff -p -u -r1.140 bozohttpd.c
--- bozohttpd.c	28 Sep 2006 05:24:29 -0000	1.140
+++ bozohttpd.c	7 Mar 2008 18:07:53 -0000
@@ -1379,12 +1379,12 @@ fix_url_percent(http_req *request)
 		buf[2] = '\0';
 		s++;
 		*t = (char)strtol(buf, NULL, 16);
-		debug((DEBUG_EXPLODING, "fu_%%: strtol put %c into *t", *t));
+		debug((DEBUG_EXPLODING, "fu_%%: strtol put '%c' into *t", *t));
 		if (*t++ == '\0')
 			http_error(400, request, "percent hack got a 0 back");
 
 		while (*s && *s != '%') {
-			if (s >= end)
+			if (end && s >= end)
 				break;
 			*t++ = *s++;
 		}
