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 2015/09/03 17:40:18 UTC

[1/2] trafficserver git commit: TS-3887: Use snprintf() instead of sprintf() in UrlPrintHack

Repository: trafficserver
Updated Branches:
  refs/heads/master 558243240 -> 340d9cb0e


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


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

Branch: refs/heads/master
Commit: 98ab90758e3f28a71beb011afb3e83260e77289d
Parents: 5582432
Author: Masa Sekimura <se...@gmail.com>
Authored: Wed Sep 2 21:02:14 2015 -0600
Committer: Phil Sorber <so...@apache.org>
Committed: Thu Sep 3 09:22:03 2015 -0600

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/98ab9075/proxy/hdrs/HTTP.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index 3a3d067..aa0040b 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -1607,7 +1607,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;
@@ -1653,7 +1653,7 @@ class UrlPrintHack
   HTTPHdr *m_hdr;
   ///@}
   /// Temporary buffer for port data.
-  char m_port_buff[6];
+  char m_port_buff[32];
 };
 
 char *


[2/2] trafficserver git commit: TS-3888: Initialize memory if buffer is large enough

Posted by so...@apache.org.
TS-3888: Initialize memory if buffer is large enough


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

Branch: refs/heads/master
Commit: 340d9cb0e6dde185665dc3addbc809aa40fecae9
Parents: 98ab907
Author: Masakazu Kitajo <m4...@gmail.com>
Authored: Wed Sep 2 20:59:35 2015 -0600
Committer: Phil Sorber <so...@apache.org>
Committed: Thu Sep 3 09:26:25 2015 -0600

----------------------------------------------------------------------
 proxy/http2/HTTP2.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/340d9cb0/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index b6e34b0..34166d3 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -275,10 +275,13 @@ http2_write_settings(const Http2SettingsParameter &param, const IOVec &iov)
 bool
 http2_write_ping(const uint8_t *opaque_data, IOVec iov)
 {
-  if (iov.iov_len != HTTP2_PING_LEN)
+  byte_pointer ptr(iov.iov_base);
+
+  if (unlikely(iov.iov_len < HTTP2_PING_LEN)) {
     return false;
+  }
 
-  memcpy(iov.iov_base, opaque_data, HTTP2_PING_LEN);
+  write_and_advance(ptr, opaque_data, HTTP2_PING_LEN);
 
   return true;
 }