Repository: trafficserver
Updated Branches:
  refs/heads/5.3.x b77fff574 -> 6acb0fec7


TS-3887: Use snprintf() instead of sprintf() in UrlPrintHack

(cherry picked from commit 98ab90758e3f28a71beb011afb3e83260e77289d)


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/09ed3d45
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/09ed3d45
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/09ed3d45

Branch: refs/heads/5.3.x
Commit: 09ed3d450a8add75f7fd32933a93a37212fa6566
Parents: b77fff5
Author: Masa Sekimura <[email protected]>
Authored: Wed Sep 2 21:02:14 2015 -0600
Committer: Phil Sorber <[email protected]>
Committed: Thu Sep 3 09:42:46 2015 -0600

----------------------------------------------------------------------
 proxy/hdrs/HTTP.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/09ed3d45/proxy/hdrs/HTTP.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index c5953b6..daf3e05 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -1594,7 +1594,7 @@ class UrlPrintHack
       if (0 == hdr->m_url_cached.port_get_raw() && hdr->m_port_in_header) {
         ink_assert(0 == ui->m_ptr_port); // shouldn't be set if not in URL.
         ui->m_ptr_port = m_port_buff;
-        ui->m_len_port = sprintf(m_port_buff, "%.5d", hdr->m_port);
+        ui->m_len_port = snprintf(m_port_buff, sizeof(m_port_buff), "%d", 
hdr->m_port);
         m_port_modified_p = true;
       } else {
         m_port_modified_p = false;
@@ -1640,7 +1640,7 @@ class UrlPrintHack
   HTTPHdr *m_hdr;
   ///@}
   /// Temporary buffer for port data.
-  char m_port_buff[6];
+  char m_port_buff[32];
 };
 
 char *

Reply via email to