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:23:51 +0900 |
commit | eb851c998d2a37a6512a26dba11a303babe6316a (patch) | |
tree | d59e58878b6b2efee3edc9eca817cd6732cab05d | |
parent | 9009ec051554bac71e7eac701936743de52c2322 (diff) | |
download | postgresql-eb851c998d2a37a6512a26dba11a303babe6316a.tar.gz postgresql-eb851c998d2a37a6512a26dba11a303babe6316a.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 e89f2d9bd6e..36902210b8a 100644 --- a/src/bin/psql/psqlscan.l +++ b/src/bin/psql/psqlscan.l @@ -1656,7 +1656,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; } } |