Repository: trafficserver Updated Branches: refs/heads/master 4c65b7775 -> 9399a7641
TS-3841: LogAccess.cc assert failed when enabling custom log and stats_over_http plugin Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/9399a764 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/9399a764 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/9399a764 Branch: refs/heads/master Commit: 9399a76410de027092b20e0a287f315fca20257d Parents: 4c65b77 Author: Bryan Call <[email protected]> Authored: Mon Jan 11 17:35:50 2016 -0800 Committer: Bryan Call <[email protected]> Committed: Mon Jan 11 17:35:50 2016 -0800 ---------------------------------------------------------------------- proxy/logging/LogAccessHttp.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9399a764/proxy/logging/LogAccessHttp.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogAccessHttp.cc b/proxy/logging/LogAccessHttp.cc index 68e3bff..3d12ebf 100644 --- a/proxy/logging/LogAccessHttp.cc +++ b/proxy/logging/LogAccessHttp.cc @@ -506,16 +506,29 @@ LogAccessHttp::marshal_client_req_unmapped_url_path(char *buf) int LogAccessHttp::marshal_client_req_unmapped_url_host(char *buf) { - int len = INK_MIN_ALIGN; + int plen = INK_MIN_ALIGN; validate_unmapped_url(); validate_unmapped_url_path(); - len = round_strlen(m_client_req_unmapped_url_host_len + 1); // +1 for eos + int alen = m_client_req_unmapped_url_host_len; + if (alen < 0) { + alen = 0; + } + + // calculate the the padded length only if the actual length + // is not zero. We don't want the padded length to be zero + // because marshal_mem should write the DEFAULT_STR to the + // buffer if str is nil, and we need room for this. + if (alen) { + plen = round_strlen(alen + 1); // +1 for eos + } + if (buf) { - marshal_mem(buf, m_client_req_unmapped_url_host_str, m_client_req_unmapped_url_host_len, len); + marshal_mem(buf, m_client_req_unmapped_url_host_str, alen, plen); } - return len; + + return plen; } int
