commit eb2db98a676321b814fc4a51c4fb7928a8bb45d9 (refs/remotes/origin/v3.5)
Author: Amos Jeffries <yadij@users.noreply.github.com>
Date:   2018-01-19 13:54:14 +1300

    ESI: make sure endofName never exceeds tagEnd (#130)

Index: squid3-3.3.8/src/esi/CustomParser.cc
===================================================================
--- squid3-3.3.8.orig/src/esi/CustomParser.cc	2018-02-01 10:09:40.039792155 -0500
+++ squid3-3.3.8/src/esi/CustomParser.cc	2018-02-01 10:09:40.035792141 -0500
@@ -140,7 +140,7 @@ ESICustomParser::parse(char const *dataT
 
             char * endofName = strpbrk(const_cast<char *>(tag), w_space);
 
-            if (endofName > tagEnd)
+            if (!endofName || endofName > tagEnd)
                 endofName = const_cast<char *>(tagEnd);
 
             *endofName = '\0';
@@ -232,7 +232,7 @@ ESICustomParser::parse(char const *dataT
 
             char * endofName = strpbrk(const_cast<char *>(tag), w_space);
 
-            if (endofName > tagEnd)
+            if (!endofName || endofName > tagEnd)
                 endofName = const_cast<char *>(tagEnd);
 
             *endofName = '\0';
