httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1540721 - in /httpd/httpd/branches/2.4.x: ./ modules/proxy/mod_proxy.c
Date Mon, 11 Nov 2013 13:53:31 GMT
Author: jim
Date: Mon Nov 11 13:53:31 2013
New Revision: 1540721

URL: http://svn.apache.org/r1540721
Log:
Merge r1532746 from trunk:

No more magic numbers.
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1532746

Modified: httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c?rev=1540721&r1=1540720&r2=1540721&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c Mon Nov 11 13:53:31 2013
@@ -177,15 +177,17 @@ static const char *set_worker_param(apr_
     else if (!strcasecmp(key, "route")) {
         /* Worker route.
          */
-        if (strlen(val) >= PROXY_WORKER_MAX_ROUTE_SIZE)
-            return "Route length must be < 64 characters";
+        if (strlen(val) >= sizeof(worker->s->route))
+            return apr_psprintf(p, "Route length must be < %d characters",
+                    (int)sizeof(worker->s->route));
         PROXY_STRNCPY(worker->s->route, val);
     }
     else if (!strcasecmp(key, "redirect")) {
         /* Worker redirection route.
          */
-        if (strlen(val) >= PROXY_WORKER_MAX_ROUTE_SIZE)
-            return "Redirect length must be < 64 characters";
+        if (strlen(val) >= sizeof(worker->s->redirect))
+            return apr_psprintf(p, "Redirect length must be < %d characters",
+                    (int)sizeof(worker->s->redirect));
         PROXY_STRNCPY(worker->s->redirect, val);
     }
     else if (!strcasecmp(key, "status")) {
@@ -256,8 +258,9 @@ static const char *set_worker_param(apr_
         worker->s->conn_timeout_set = 1;
     }
     else if (!strcasecmp(key, "flusher")) {
-        if (strlen(val) >= PROXY_WORKER_MAX_SCHEME_SIZE)
-            return "flusher name length must be < 16 characters";
+        if (strlen(val) >= sizeof(worker->s->flusher))
+            apr_psprintf(p, "flusher name length must be < %d characters",
+                    (int)sizeof(worker->s->flusher));
         PROXY_STRNCPY(worker->s->flusher, val);
     }
     else {
@@ -280,8 +283,9 @@ static const char *set_balancer_param(pr
          * Set to something like JSESSIONID or
          * PHPSESSIONID, etc..,
          */
-        if (strlen(val) > (PROXY_BALANCER_MAX_STICKY_SIZE-1))
-            return "stickysession length must be < 64 characters";
+        if (strlen(val) >= sizeof(balancer->s->sticky_path))
+            apr_psprintf(p, "stickysession length must be < %d characters",
+                    (int)sizeof(balancer->s->sticky_path));
         PROXY_STRNCPY(balancer->s->sticky_path, val);
         PROXY_STRNCPY(balancer->s->sticky, val);
 



Mime
View raw message