summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2017-05-15 10:40:47 +0000
committerjsg <jsg@openbsd.org>2017-05-15 10:40:47 +0000
commit60acb58ba992521710644ce12f224887f2d6c6ec (patch)
treedb55944b777a58df6115ad29b57118ebdb97c657
parentMake atomic.h ready to be included in userland. (diff)
downloadwireguard-openbsd-60acb58ba992521710644ce12f224887f2d6c6ec.tar.xz
wireguard-openbsd-60acb58ba992521710644ce12f224887f2d6c6ec.zip
Avoid a crash servicing requests when a server is configured with
"block return 401". Problem reported by Jurjen Oskam. ok florian@
-rw-r--r--usr.sbin/httpd/server_http.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c
index d530c12c2d5..e64de0d2f9c 100644
--- a/usr.sbin/httpd/server_http.c
+++ b/usr.sbin/httpd/server_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_http.c,v 1.116 2017/03/16 10:18:11 florian Exp $ */
+/* $OpenBSD: server_http.c,v 1.117 2017/05/15 10:40:47 jsg Exp $ */
/*
* Copyright (c) 2006 - 2017 Reyk Floeter <reyk@openbsd.org>
@@ -887,6 +887,8 @@ server_abort_http(struct client *clt, unsigned int code, const char *msg)
msg = buf;
break;
case 401:
+ if (msg == NULL)
+ break;
if (stravis(&escapedmsg, msg, VIS_DQ) == -1) {
code = 500;
extraheader = NULL;
@@ -898,6 +900,8 @@ server_abort_http(struct client *clt, unsigned int code, const char *msg)
}
break;
case 416:
+ if (msg == NULL)
+ break;
if (asprintf(&extraheader,
"Content-Range: %s\r\n", msg) == -1) {
code = 500;