You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/06/22 21:40:31 UTC

[trafficserver] 11/14: TS-4571: Fix "pointer to local outside scope" (CID 1356978) (#727)

This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 1034f6cc764104457f31b6c4369c28bce8241fa5
Author: Phil Sorber <so...@apache.org>
AuthorDate: Wed Jun 22 14:43:23 2016 -0600

    TS-4571: Fix "pointer to local outside scope" (CID 1356978) (#727)
    
    (cherry picked from commit 0597cfefed63ec29fd210953226da89b25bf9f15)
---
 proxy/ParentSelection.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc
index 41ccef5..d6626c8 100644
--- a/proxy/ParentSelection.cc
+++ b/proxy/ParentSelection.cc
@@ -534,6 +534,7 @@ ParentRecord::Init(matcher_line *line_info)
   char *val;
   bool used = false;
   ParentRR_t round_robin = P_NO_ROUND_ROBIN;
+  char buf[128];
 
   this->line_num = line_info->line_num;
   this->scheme = NULL;
@@ -613,8 +614,8 @@ ParentRecord::Init(matcher_line *line_info)
         max_simple_retries = v;
         used = true;
       } else {
-        char buf[128];
-        sprintf(buf, "invalid argument to max_simple_retries.  Argument must be between 1 and %d.", MAX_SIMPLE_RETRIES);
+        snprintf(buf, sizeof(buf), "invalid argument to max_simple_retries.  Argument must be between 1 and %d.",
+                 MAX_SIMPLE_RETRIES);
         errPtr = buf;
       }
     } else if (strcasecmp(label, "max_unavailable_server_retries") == 0) {
@@ -623,9 +624,8 @@ ParentRecord::Init(matcher_line *line_info)
         max_unavailable_server_retries = v;
         used = true;
       } else {
-        char buf[128];
-        sprintf(buf, "invalid argument to max_unavailable_server_retries.  Argument must be between 1 and %d.",
-                MAX_UNAVAILABLE_SERVER_RETRIES);
+        snprintf(buf, sizeof(buf), "invalid argument to max_unavailable_server_retries.  Argument must be between 1 and %d.",
+                 MAX_UNAVAILABLE_SERVER_RETRIES);
         errPtr = buf;
       }
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.