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 <[email protected]> Authored: Wed Sep 2 20:59:35 2015 -0600 Committer: Phil Sorber <[email protected]> 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 ¶m, 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; }
