projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6fa0911
)
Fix [ 665014 ] files with long lines and an encoding crash.
author
Mark Hammond
<mhammond@skippinet.com.au>
Tue, 14 Jan 2003 23:15:22 +0000
(23:15 +0000)
committer
Mark Hammond
<mhammond@skippinet.com.au>
Tue, 14 Jan 2003 23:15:22 +0000
(23:15 +0000)
Ensure that the 'size' arg is correctly passed to the encoding reader to
prevent buffer overflows.
Parser/tokenizer.c
patch
|
blob
|
history
diff --git
a/Parser/tokenizer.c
b/Parser/tokenizer.c
index d7a223ae0f8a6bb8219d93d258dd078536a7cbd5..aaed637a2fdec2845a6b4f6089a5ae987fc7916e 100644
(file)
--- a/
Parser/tokenizer.c
+++ b/
Parser/tokenizer.c
@@
-346,7
+346,8
@@
fp_readl(char *s, int size, struct tok_state *tok)
PyObject* utf8;
PyObject* buf = tok->decoding_buffer;
if (buf == NULL) {
- PyObject *args = PyTuple_New(0);
+ /* Ask for one less byte so we can terminate it */
+ PyObject *args = Py_BuildValue("(i)", size-1);
if (args == NULL)
return error_ret(tok);
buf = PyObject_Call(tok->decoding_readline, args, NULL);