diff options
author | Tatsuo Ishii <ishii@postgresql.org> | 2012-12-02 21:11:15 +0900 |
---|---|---|
committer | Tatsuo Ishii <ishii@postgresql.org> | 2012-12-02 21:21:40 +0900 |
commit | a7c53092d88bf9c617713389bc11f0670762b723 (patch) | |
tree | 7956d9f18eb0b67a8d6e0e93e848912f399356eb | |
parent | 647b1bcdfd26f786248366e4fb25c0fd62006329 (diff) | |
download | postgresql-a7c53092d88bf9c617713389bc11f0670762b723.tar.gz postgresql-a7c53092d88bf9c617713389bc11f0670762b723.zip |
Fix psql crash while parsing SQL file whose encoding is different from
client encoding and the client encoding is not *safe* one. Such an
example is, file encoding is UTF-8 and client encoding SJIS. Patch
contributed by Jiang Guiqing.
-rw-r--r-- | src/bin/psql/psqlscan.l | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/psql/psqlscan.l b/src/bin/psql/psqlscan.l index 1d4e7f11e99..8cef0f248f0 100644 --- a/src/bin/psql/psqlscan.l +++ b/src/bin/psql/psqlscan.l @@ -1803,7 +1803,7 @@ prepare_buffer(const char *txt, int len, char **txtcopy) /* first byte should always be okay... */ newtxt[i] = txt[i]; i++; - while (--thislen > 0) + while (--thislen > 0 && i < len) newtxt[i++] = (char) 0xFF; } } |