projects
/
postgresql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dbf2e26
)
Fix psql crash while parsing SQL file whose encoding is different from
author
Tatsuo Ishii
Sun, 2 Dec 2012 12:11:15 +0000
(21:11 +0900)
committer
Tatsuo Ishii
Sun, 2 Dec 2012 12:22:01 +0000
(21:22 +0900)
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.
src/bin/psql/psqlscan.l
patch
|
blob
|
blame
|
history
diff --git
a/src/bin/psql/psqlscan.l
b/src/bin/psql/psqlscan.l
index 5fefa475af6c529dd8f1a3156b9695045e8663f3..f9970859e2ea255e3c93bdadb3d666e202a15b7e 100644
(file)
--- 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;
}
}