From a2ffb0476f2a5add00cced519cef6905c156373e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 2 Feb 2017 12:58:30 +0200 Subject: [PATCH] Fix insertstream value implicit insert detection The pointer being at the end of the buffer was not checked. --- server/modules/filter/insertstream/insertstream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/modules/filter/insertstream/insertstream.c b/server/modules/filter/insertstream/insertstream.c index 20cf10a04..8620dd483 100644 --- a/server/modules/filter/insertstream/insertstream.c +++ b/server/modules/filter/insertstream/insertstream.c @@ -540,12 +540,12 @@ static bool only_implicit_values(GWBUF *buffer) /** Skip the closing parenthesis and any whitespace */ ptr++; - while (isspace(*ptr) && ptr < (char*)buffer->end) + while (ptr < (char*)buffer->end && isspace(*ptr)) { ptr++; } - if (!isalnum(*ptr) && ptr < (char*)buffer->end) + if (ptr >= (char*)buffer->end || !isalnum(*ptr)) { /** * The first pair of parentheses was followed by a non-alphanumeric