1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

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.
This commit is contained in:
Tatsuo Ishii
2012-12-02 21:11:15 +09:00
parent dbf2e26390
commit ceee108acd

View File

@ -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;
}
}