TS-3888: Initialize memory if buffer is large enough (cherry picked from commit 340d9cb0e6dde185665dc3addbc809aa40fecae9)
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/af7da74d Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/af7da74d Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/af7da74d Branch: refs/heads/5.3.x Commit: af7da74d8b0f1ae97bc3df00320daaf1b04b1f3d Parents: 252e45f Author: Masakazu Kitajo <[email protected]> Authored: Wed Sep 2 20:59:35 2015 -0600 Committer: Phil Sorber <[email protected]> Committed: Thu Sep 3 09:47:08 2015 -0600 ---------------------------------------------------------------------- proxy/http2/HTTP2.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/af7da74d/proxy/http2/HTTP2.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc index 6a8b290..038f5ce 100644 --- a/proxy/http2/HTTP2.cc +++ b/proxy/http2/HTTP2.cc @@ -263,10 +263,13 @@ http2_write_settings(const Http2SettingsParameter ¶m, 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; }
