From bd4264e5207bc2ad88906d53f58e48cbd0a1dfa3 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 30 Oct 2012 07:41:20 +0100 Subject: [PATCH] CData: Fixed handling of whitespace + garbage detection at end of input. WTF happened there?!? ;-) --- src/cdata.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cdata.c b/src/cdata.c index 7ee14e6..021ba1a 100644 --- a/src/cdata.c +++ b/src/cdata.c @@ -160,9 +160,13 @@ cdata_in(PG_FUNCTION_ARGS) )); while ((*endptr != '\0') && isspace((int)*endptr)) + ++endptr; + + if (*endptr != '\0') ereport(ERROR, ( errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for cdata: \"%s\"", orig) + errmsg("invalid input syntax for cdata: \"%s\"", orig), + errhint("garbage found after number: \"%s\"", endptr) )); if (typmod > 0) -- 2.30.2