This is an automated email from the ASF dual-hosted git repository. wkaras pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 1a2a4d1353 Pass url_len when emplacing in Http2CommonSession::_h2_pushed_urls (#11382) 1a2a4d1353 is described below commit 1a2a4d1353b33b99dee389237814574708f53db8 Author: Pavel Vazharov <pa...@x3me.net> AuthorDate: Thu May 23 15:53:52 2024 +0300 Pass url_len when emplacing in Http2CommonSession::_h2_pushed_urls (#11382) * Pass url_len when emplacing in Http2CommonSession::_h2_pushed_urls * Sanitize url and url_len arguments passed to TSHttpTxnServerPush This is needed because the function add_url_to_pushed_table, which is used internally, expects valid and non negative url_len. --- src/api/InkAPI.cc | 5 +++++ src/proxy/http2/Http2CommonSession.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc index c766b7ceac..ff02c1c385 100644 --- a/src/api/InkAPI.cc +++ b/src/api/InkAPI.cc @@ -6788,6 +6788,11 @@ TSReturnCode TSHttpTxnServerPush(TSHttpTxn txnp, const char *url, int url_len) { sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS); + sdk_assert(url != nullptr); + + if (url_len < 0) { + url_len = strlen(url); + } URL url_obj; url_obj.create(nullptr); diff --git a/src/proxy/http2/Http2CommonSession.cc b/src/proxy/http2/Http2CommonSession.cc index 7a46d37712..b17da6def1 100644 --- a/src/proxy/http2/Http2CommonSession.cc +++ b/src/proxy/http2/Http2CommonSession.cc @@ -466,7 +466,7 @@ Http2CommonSession::add_url_to_pushed_table(const char *url, int url_len) } if (_h2_pushed_urls->size() < Http2::push_diary_size) { - _h2_pushed_urls->emplace(url); + _h2_pushed_urls->emplace(url, url_len); } }