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:19 UTC

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

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;
 }