Module Name:    src
Committed By:   leot
Date:           Sat Dec 15 09:28:27 UTC 2018

Modified Files:
        src/libexec/httpd: bozohttpd.c

Log Message:
Avoid possible NULL dereference when sending a big request that timeout.

Problem reported by <maya> and reviewed by <maya> and <mrg>, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/libexec/httpd/bozohttpd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.103 src/libexec/httpd/bozohttpd.c:1.104
--- src/libexec/httpd/bozohttpd.c:1.103	Sat Dec 15 02:03:24 2018
+++ src/libexec/httpd/bozohttpd.c	Sat Dec 15 09:28:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.c,v 1.103 2018/12/15 02:03:24 maya Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.104 2018/12/15 09:28:27 leot Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -2260,7 +2260,8 @@ bozo_http_error(bozohttpd_t *httpd, int 
 	if (request && request->hr_allow)
 		bozo_printf(httpd, "Allow: %s\r\n", request->hr_allow);
 	/* RFC 7231 (HTTP/1.1) 6.5.7 */
-	if (code == 408 && request->hr_proto == httpd->consts.http_11)
+	if (code == 408 && request &&
+	    request->hr_proto == httpd->consts.http_11)
 		bozo_printf(httpd, "Connection: close\r\n");
 	bozo_printf(httpd, "\r\n");
 	/* According to the RFC 2616 sec. 9.4 HEAD method MUST NOT return a

Reply via email to