summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2011-01-05 12:47:14 +0000
committerJasper Lievisse Adriaanse <jasper@cvs.openbsd.org>2011-01-05 12:47:14 +0000
commit757e0fa6272454330145cf15bf92a4571e979914 (patch)
tree6d3c94f8573d80c556228a756b6891d55eabc6c4 /usr.sbin
parent0bdd7db9a834d43e0d7555e04fc0a37f2f702bb2 (diff)
- properly fix pr6009. a different fix was commited as the original patch
used atoi(). this fix uses strtonum() instead. from bjorn ketelaars, pr6515. ok henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/httpd/src/modules/proxy/proxy_http.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/httpd/src/modules/proxy/proxy_http.c b/usr.sbin/httpd/src/modules/proxy/proxy_http.c
index b7b299a5e94..fadbbb4046e 100644
--- a/usr.sbin/httpd/src/modules/proxy/proxy_http.c
+++ b/usr.sbin/httpd/src/modules/proxy/proxy_http.c
@@ -169,6 +169,8 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url,
int result, major, minor;
const char *content_length;
const char *peer;
+ int destportstrtonum;
+ const char *errstr;
void *sconf = r->server->module_config;
proxy_server_conf *conf =
@@ -367,7 +369,11 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url,
AP_HOOK_DECLINE(DECLINED),
&rc, r, f, desthost, destportstr, destportstr);
if (rc == DECLINED) {
- if (destportstr != NULL && destport != DEFAULT_HTTP_PORT)
+ destportstrtonum = strtonum(destportstr, 0, 65535, &errstr);
+ if (errstr)
+ errx(1, "The destination port is %s: %s", errstr, destportstr);
+
+ if (destportstr != NULL && destportstrtonum != destport)
ap_bvputs(f, "Host: ", desthost, ":", destportstr, CRLF, NULL);
else
ap_bvputs(f, "Host: ", desthost, CRLF, NULL);