Repository: trafficserver
Updated Branches:
  refs/heads/6.1.x f4b33e684 -> 41964ab76


TS-3841: LogAccess.cc assert failed when enabling custom log and 
stats_over_http plugin

(cherry picked from commit 9399a76410de027092b20e0a287f315fca20257d)


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c35ea7ff
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c35ea7ff
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c35ea7ff

Branch: refs/heads/6.1.x
Commit: c35ea7ff08ce9402b7e3c9bb5c522d6e5ed2ec4c
Parents: f4b33e6
Author: Bryan Call <[email protected]>
Authored: Mon Jan 11 17:35:50 2016 -0800
Committer: Bryan Call <[email protected]>
Committed: Tue Jan 12 09:23:41 2016 -0800

----------------------------------------------------------------------
 proxy/logging/LogAccessHttp.cc | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c35ea7ff/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

Reply via email to