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:22:01 +0900 |
| commit | ceee108acdf4c1f962574b3f9f9a6999891771dd (patch) | |
| tree | 26a2f09fed5f793ef81caacb6f06870620ac7809 /src | |
| parent | dbf2e2639067d95f507b727989454a74981fbc31 (diff) | |
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.
Diffstat (limited to 'src')
| -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 5fefa475af6..f9970859e2e 100644 --- a/src/bin/psql/psqlscan.l +++ b/src/bin/psql/psqlscan.l @@ -1806,7 +1806,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; } } |
