Repository: trafficserver Updated Branches: refs/heads/master b1c542a50 -> 11537217c
Use memcpy() instead of strncpy() on non-NULL terminated strings. This is safer and faster, and avoids a Coverity error. Coverity CID #1254810 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a1a30aa4 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a1a30aa4 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a1a30aa4 Branch: refs/heads/master Commit: a1a30aa47e3c5c790042f034cbfe71fbdaadcfab Parents: b1c542a Author: Leif Hedstrom <[email protected]> Authored: Fri Jan 9 07:28:30 2015 -0700 Committer: Leif Hedstrom <[email protected]> Committed: Fri Jan 9 07:28:30 2015 -0700 ---------------------------------------------------------------------- proxy/http2/HTTP2.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a1a30aa4/proxy/http2/HTTP2.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc index c1c181d..e1d2ab3 100644 --- a/proxy/http2/HTTP2.cc +++ b/proxy/http2/HTTP2.cc @@ -305,10 +305,11 @@ convert_from_2_to_1_1_header(HTTPHdr* headers) size_t url_length = scheme_len + 3 + authority_len + path_len; char* url = arena.str_alloc(url_length); const char* url_start = url; - strncpy(url, scheme, scheme_len); - strncpy(url+scheme_len, "://", 3); - strncpy(url+scheme_len+3, authority, authority_len); - strncpy(url+scheme_len+3+authority_len, path, path_len); + + memcpy(url, scheme, scheme_len); + memcpy(url+scheme_len, "://", 3); + memcpy(url+scheme_len+3, authority, authority_len); + memcpy(url+scheme_len+3+authority_len, path, path_len); url_parse(headers->m_heap, headers->m_http->u.req.m_url_impl, &url_start, url + url_length, 1); arena.str_free(url);
