Use correct length to convert json unicode escapes.
authorAndrew Dunstan <andrew@dunslane.net>
Wed, 1 May 2013 22:47:18 +0000 (18:47 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Wed, 1 May 2013 22:47:18 +0000 (18:47 -0400)
Bug reported on IRC - fix due to Andrew Gierth.

src/backend/utils/adt/json.c

index 90404f34effd1988ac66a186a8d8a09b8d1ae1bc..507c91ff97b2fd30269c1d4a450e7b72e2cf0e07 100644 (file)
@@ -721,7 +721,7 @@ json_lex_string(JsonLexContext *lex)
                    unicode_to_utf8(ch, (unsigned char *) utf8str);
                    utf8len = pg_utf_mblen((unsigned char *) utf8str);
                    utf8str[utf8len] = '\0';
-                   converted = pg_any_to_server(utf8str, 1, PG_UTF8);
+                   converted = pg_any_to_server(utf8str, utf8len, PG_UTF8);
                    appendStringInfoString(lex->strval, converted);
                    if (converted != utf8str)
                        pfree(converted);