From 67107b5412db029070c081791ecdfd64f0a84ab3 Mon Sep 17 00:00:00 2001 From: ChudaykinAlex Date: Fri, 7 Aug 2026 11:08:01 +0300 Subject: [PATCH] Fixed a trailing garbage character being accepted after a special date/time expression CAST('NOW)' AS TIMESTAMP) succeeded instead of raising a conversion error: the loop validating the rest of the string incremented p in its condition, so the first character not consumed as a part of the word was never checked. --- src/common/cvt.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index 73b30349ac7..1a876892a3f 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -839,10 +839,15 @@ void CVT_string_to_datetime(const dsc* desc, description[i] = SPECIAL; - while (++p < end) + // Note: p points to the first character not consumed as a part of + // the word, so it must be checked too. + + while (p < end) { if (*p != ' ' && *p != '\t' && *p != '\0') CVT_conversion_error(desc, cb->err); + + ++p; } // fetch the current datetime