summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2014-09-15 08:06:12 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2014-09-15 08:06:12 +0000
commite158725fa25fd8df580ac2e6d6a32bbf42e6e2f8 (patch)
treefb9ff49166e57397b86ed30c9c1f0401d83ad34d /usr.sbin/relayd
parent5629a228bd7273bd4c316900845625fb2e009db8 (diff)
Make the HTTP version mandatory and abort if it is missing in the request.
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r--usr.sbin/relayd/relay_http.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/relayd/relay_http.c b/usr.sbin/relayd/relay_http.c
index 8c711df416a..fa7b2cee839 100644
--- a/usr.sbin/relayd/relay_http.c
+++ b/usr.sbin/relayd/relay_http.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay_http.c,v 1.33 2014/08/10 21:55:17 bluhm Exp $ */
+/* $OpenBSD: relay_http.c,v 1.34 2014/09/15 08:06:11 reyk Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -291,18 +291,20 @@ relay_read_http(struct bufferevent *bev, void *arg)
goto fail;
}
desc->http_version = strchr(desc->http_path, ' ');
- if (desc->http_version != NULL)
- *desc->http_version++ = '\0';
+ if (desc->http_version == NULL) {
+ free(line);
+ goto fail;
+ }
+ *desc->http_version++ = '\0';
desc->http_query = strchr(desc->http_path, '?');
if (desc->http_query != NULL)
*desc->http_query++ = '\0';
/*
* Have to allocate the strings because they could
- * be changed independetly by the filters later.
+ * be changed independently by the filters later.
*/
- if (desc->http_version != NULL &&
- (desc->http_version =
+ if ((desc->http_version =
strdup(desc->http_version)) == NULL) {
free(line);
goto fail;