]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
ESI: make sure endofName never exceeds tagEnd (#130)
authorAmos Jeffries <yadij@users.noreply.github.com>
Fri, 19 Jan 2018 00:54:14 +0000 (13:54 +1300)
committerGitHub <noreply@github.com>
Fri, 19 Jan 2018 00:54:14 +0000 (13:54 +1300)
src/esi/CustomParser.cc

index d86d2d309b5ce8f84ff6c6a15ec6443d62ad239c..db634d92190e117c113a95208cb4bdc40a8e6c09 100644 (file)
@@ -121,7 +121,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool
 
             char * endofName = strpbrk(const_cast<char *>(tag), w_space);
 
-            if (endofName > tagEnd)
+            if (!endofName || endofName > tagEnd)
                 endofName = const_cast<char *>(tagEnd);
 
             *endofName = '\0';
@@ -214,7 +214,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool
 
             char * endofName = strpbrk(const_cast<char *>(tag), w_space);
 
-            if (endofName > tagEnd)
+            if (!endofName || endofName > tagEnd)
                 endofName = const_cast<char *>(tagEnd);
 
             *endofName = '\0';