From: Aaron Bannert Date: Mon, 29 Oct 2001 15:44:03 +0000 (+0000) Subject: Fix a truncation bug in how we print the port on the Via: header. X-Git-Tag: 2.0.27~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1087db6a1d98a62dc9401694ddc03fd79d0c25a4;p=thirdparty%2Fapache%2Fhttpd.git Fix a truncation bug in how we print the port on the Via: header. The routine that prints the Via: header now takes a length for the port string. Submitted by: Zvi Har'El git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91682 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index 0ede23f30ac..7687fbe4cc0 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -194,7 +194,8 @@ apr_status_t ap_proxy_http_determine_connection(apr_pool_t *p, request_rec *r, char **url, const char *proxyname, apr_port_t proxyport, - char *server_portstr) { + char *server_portstr, + int server_portstr_size) { int server_port; apr_status_t err; apr_sockaddr_t *uri_addr; @@ -253,7 +254,7 @@ apr_status_t ap_proxy_http_determine_connection(apr_pool_t *p, request_rec *r, if (ap_is_default_port(server_port, r)) { strcpy(server_portstr,""); } else { - apr_snprintf(server_portstr, sizeof(server_portstr), ":%d", + apr_snprintf(server_portstr, server_portstr_size, ":%d", server_port); } } @@ -940,7 +941,8 @@ int ap_proxy_http_handler(request_rec *r, proxy_server_conf *conf, /* Step One: Determine Who To Connect To */ status = ap_proxy_http_determine_connection(p, r, p_conn, c, conf, uri, &url, proxyname, proxyport, - server_portstr); + server_portstr, + sizeof(server_portstr)); if ( status != OK ) { return status; }