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

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 1462764020f4303b3e453d96e03650db88bbd89f
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Thu Jun 7 14:25:12 2018 +0200

    Fix misuse of snprintf
    
    The error was: passing argument 1 to restrict-qualified parameter aliases 
with argument 4 [-Werror=restrict]
---
 mgmt/api/APITestCliRemote.cc | 8 ++++++--
 mgmt/api/CfgContextImpl.cc   | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/mgmt/api/APITestCliRemote.cc b/mgmt/api/APITestCliRemote.cc
index 7efbeb8..99e1bfb 100644
--- a/mgmt/api/APITestCliRemote.cc
+++ b/mgmt/api/APITestCliRemote.cc
@@ -626,7 +626,9 @@ print_remap_ele(TSRemapEle *ele)
   }
   // from port
   if (ele->from_port != TS_INVALID_PORT) {
-    snprintf(buf, sizeof(buf), "%s:%d", buf, ele->from_port);
+    char port_buf[16];
+    snprintf(port_buf, sizeof(port_buf), ":%d", ele->from_port);
+    ink_strlcat(buf, port_buf, sizeof(buf));
   }
   // from host path
   if (ele->from_path_prefix) {
@@ -657,7 +659,9 @@ print_remap_ele(TSRemapEle *ele)
   }
   // to port
   if (ele->to_port != TS_INVALID_PORT) {
-    snprintf(buf, sizeof(buf), "%s:%d", buf, ele->to_port);
+    char port_buf[16];
+    snprintf(port_buf, sizeof(port_buf), ":%d", ele->to_port);
+    ink_strlcat(buf, port_buf, sizeof(buf));
   }
   // to host path
   if (ele->to_path_prefix) {
diff --git a/mgmt/api/CfgContextImpl.cc b/mgmt/api/CfgContextImpl.cc
index ac72880..8e07cc1 100644
--- a/mgmt/api/CfgContextImpl.cc
+++ b/mgmt/api/CfgContextImpl.cc
@@ -1669,7 +1669,9 @@ RemapObj::formatEleToRule()
   }
   // from port
   if (m_ele->from_port != TS_INVALID_PORT) {
-    snprintf(buf, sizeof(buf), "%s:%d", buf, m_ele->from_port);
+    char port_buf[16];
+    snprintf(port_buf, sizeof(port_buf), ":%d", m_ele->from_port);
+    ink_strlcat(buf, port_buf, sizeof(buf));
   }
   // from host path
   if (m_ele->from_path_prefix) {
@@ -1700,7 +1702,9 @@ RemapObj::formatEleToRule()
   }
   // to port
   if (m_ele->to_port != TS_INVALID_PORT) {
-    snprintf(buf, sizeof(buf), "%s:%d", buf, m_ele->to_port);
+    char port_buf[16];
+    snprintf(port_buf, sizeof(port_buf), ":%d", m_ele->to_port);
+    ink_strlcat(buf, port_buf, sizeof(buf));
   }
   // to host path
   if (m_ele->to_path_prefix) {

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to