You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2014/05/05 14:47:18 UTC

svn commit: r1592514 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h proxy_util.c

Author: trawick
Date: Mon May  5 12:47:18 2014
New Revision: 1592514

URL: http://svn.apache.org/r1592514
Log:
Clarify an existing requirement of the server_portstr parameter
to ap_proxy_determine_connection(): it must be a buffer of at
least one byte in size.

(And don't bother with using strcpy in order to zap a string.)

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy.h
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=1592514&r1=1592513&r2=1592514&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Mon May  5 12:47:18 2014
@@ -806,8 +806,9 @@ PROXY_DECLARE(int) ap_proxy_post_request
  * @param url     request url
  * @param proxyname are we connecting directly or via a proxy
  * @param proxyport proxy host port
- * @param server_portstr Via headers server port
- * @param server_portstr_size size of the server_portstr buffer
+ * @param server_portstr Via headers server port, must be non-NULL
+ * @param server_portstr_size size of the server_portstr buffer; must
+ * be at least one, even if the protocol doesn't use this
  * @return         OK or HTTP_XXX error
  */
 PROXY_DECLARE(int) ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1592514&r1=1592513&r2=1592514&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon May  5 12:47:18 2014
@@ -2329,8 +2329,9 @@ ap_proxy_determine_connection(apr_pool_t
 
     /* Get the server port for the Via headers */
     server_port = ap_get_server_port(r);
+    AP_DEBUG_ASSERT(server_portstr_size > 0);
     if (ap_is_default_port(server_port, r)) {
-        strcpy(server_portstr,"");
+        server_portstr[0] = '\0';
     }
     else {
         apr_snprintf(server_portstr, server_portstr_size, ":%d",