]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix a truncation bug in how we print the port on the Via: header.
authorAaron Bannert <aaron@apache.org>
Mon, 29 Oct 2001 15:44:03 +0000 (15:44 +0000)
committerAaron Bannert <aaron@apache.org>
Mon, 29 Oct 2001 15:44:03 +0000 (15:44 +0000)
The routine that prints the Via: header now takes a length for
the port string.

Submitted by: Zvi Har'El <rl@math.technion.ac.il>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91682 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_http.c

index 0ede23f30ac12b23fd8993dea8c22befce564d8d..7687fbe4cc06c7edf1423d17ab6c6aac98707442 100644 (file)
@@ -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;
     }