1 From eb2db98a676321b814fc4a51c4fb7928a8bb45d9 Mon Sep 17 00:00:00 2001
2 From: Amos Jeffries <yadij@users.noreply.github.com>
3 Date: Fri, 19 Jan 2018 13:54:14 +1300
4 Subject: [PATCH] ESI: make sure endofName never exceeds tagEnd (#130)
6 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
8 src/esi/CustomParser.cc | 4 ++--
9 1 file changed, 2 insertions(+), 2 deletions(-)
11 diff --git a/src/esi/CustomParser.cc b/src/esi/CustomParser.cc
12 index d86d2d309..db634d921 100644
13 --- a/src/esi/CustomParser.cc
14 +++ b/src/esi/CustomParser.cc
15 @@ -121,7 +121,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool
17 char * endofName = strpbrk(const_cast<char *>(tag), w_space);
19 - if (endofName > tagEnd)
20 + if (!endofName || endofName > tagEnd)
21 endofName = const_cast<char *>(tagEnd);
24 @@ -214,7 +214,7 @@ ESICustomParser::parse(char const *dataToParse, size_t const lengthOfData, bool
26 char * endofName = strpbrk(const_cast<char *>(tag), w_space);
28 - if (endofName > tagEnd)
29 + if (!endofName || endofName > tagEnd)
30 endofName = const_cast<char *>(tagEnd);