This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/7.1.x by this push:
     new 648b6c0  background_fetch heap-buffer-overflow fix (7.1.x)
648b6c0 is described below

commit 648b6c02252299db8d6d7f8cc7a77bd47fd730c1
Author: Gancho Tenev <gan...@apache.org>
AuthorDate: Tue Jun 19 17:26:33 2018 -0700

    background_fetch heap-buffer-overflow fix (7.1.x)
    
    A separate fix to backport to 7.1.x since std::string_view
    is not available in 7.1.x, using ts::string_view instead.
---
 plugins/background_fetch/rules.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/background_fetch/rules.cc 
b/plugins/background_fetch/rules.cc
index 3e7bfa5..889cf98 100644
--- a/plugins/background_fetch/rules.cc
+++ b/plugins/background_fetch/rules.cc
@@ -23,6 +23,7 @@
 */
 
 #include <cstdlib>
+#include "ts/string_view.h"
 
 #include "configs.h"
 #include "rules.h"
@@ -131,7 +132,7 @@ BgFetchRule::check_field_configured(TSHttpTxn txnp) const
           TSDebug(PLUGIN_NAME, "invalid field");
         } else {
           TSDebug(PLUGIN_NAME, "comparing with %s", _value);
-          if (nullptr != strstr(val_str, _value)) {
+          if (ts::string_view::npos != ts::string_view(val_str, 
val_len).find(_value)) {
             hdr_found = true;
           }
         }

Reply via email to