trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhe...@apache.org
Subject [trafficserver] branch master updated: Add protection against null pointer access
Date Sat, 10 Aug 2019 02:12:04 GMT
This is an automated email from the ASF dual-hosted git repository.

sudheerv 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 3db3932  Add protection against null pointer access
3db3932 is described below

commit 3db39328b277c9cb7e21103bdcfdae4b22715f83
Author: Sudheer Vinukonda <sudheerv@apache.org>
AuthorDate: Wed Aug 7 10:11:15 2019 -0700

    Add protection against null pointer access
    
    Unmapped URLs are not initialized for short-circuited requests before remap as
    pristine url is not set until remap. Add protection against null pointer access.
---
 proxy/logging/LogAccess.cc | 8 ++++----
 proxy/logging/LogFilter.cc | 4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/proxy/logging/LogAccess.cc b/proxy/logging/LogAccess.cc
index ec8d781..d364e30 100644
--- a/proxy/logging/LogAccess.cc
+++ b/proxy/logging/LogAccess.cc
@@ -1159,7 +1159,7 @@ LogAccess::set_client_req_url_canon(char *buf, int len)
 void
 LogAccess::set_client_req_unmapped_url_canon(char *buf, int len)
 {
-  if (buf) {
+  if (buf && m_client_req_unmapped_url_canon_str) {
     m_client_req_unmapped_url_canon_len = len;
     ink_strlcpy(m_client_req_unmapped_url_canon_str, buf, m_client_req_unmapped_url_canon_len
+ 1);
   }
@@ -1168,7 +1168,7 @@ LogAccess::set_client_req_unmapped_url_canon(char *buf, int len)
 void
 LogAccess::set_client_req_unmapped_url_path(char *buf, int len)
 {
-  if (buf) {
+  if (buf && m_client_req_unmapped_url_path_str) {
     m_client_req_unmapped_url_path_len = len;
     ink_strlcpy(m_client_req_unmapped_url_path_str, buf, m_client_req_unmapped_url_path_len
+ 1);
   }
@@ -1177,7 +1177,7 @@ LogAccess::set_client_req_unmapped_url_path(char *buf, int len)
 void
 LogAccess::set_client_req_unmapped_url_host(char *buf, int len)
 {
-  if (buf) {
+  if (buf && m_client_req_unmapped_url_host_str) {
     m_client_req_unmapped_url_host_len = len;
     ink_strlcpy(m_client_req_unmapped_url_host_str, buf, m_client_req_unmapped_url_host_len
+ 1);
   }
@@ -1187,7 +1187,7 @@ void
 LogAccess::set_client_req_url_path(char *buf, int len)
 {
   //?? use m_client_req_unmapped_url_path_str for now..may need to enhance later..
-  if (buf) {
+  if (buf && m_client_req_unmapped_url_path_str) {
     m_client_req_url_path_len = len;
     ink_strlcpy(m_client_req_unmapped_url_path_str, buf, m_client_req_url_path_len + 1);
   }
diff --git a/proxy/logging/LogFilter.cc b/proxy/logging/LogFilter.cc
index 4bdec48..6091bd5 100644
--- a/proxy/logging/LogFilter.cc
+++ b/proxy/logging/LogFilter.cc
@@ -366,7 +366,9 @@ LogFilterString::wipe_this_entry(LogAccess *lad)
     ink_assert(!"INVALID FILTER OPERATOR");
   }
 
-  m_field->updateField(lad, buf, strlen(buf));
+  if (cond_satisfied) {
+    m_field->updateField(lad, buf, strlen(buf));
+  }
 
   ats_free(big_buf);
   ats_free(big_buf_upper);


Mime
View raw message