diff options
author | Mark Hammond <mhammond@skippinet.com.au> | 2003-01-14 23:15:22 (GMT) |
---|---|---|
committer | Mark Hammond <mhammond@skippinet.com.au> | 2003-01-14 23:15:22 (GMT) |
commit | a2e303c32d415c2921672d87268b80d6aa824e21 (patch) | |
tree | 0ecea9860b9ebd4a13274fe3f03aeda959ffa5fb /Parser/tokenizer.c | |
parent | 6fa0911f5ab04d1d76a646d18dd4ad3a5cfd2828 (diff) | |
download | cpython-a2e303c32d415c2921672d87268b80d6aa824e21.zip cpython-a2e303c32d415c2921672d87268b80d6aa824e21.tar.gz cpython-a2e303c32d415c2921672d87268b80d6aa824e21.tar.bz2 |
Fix [ 665014 ] files with long lines and an encoding crash.
Ensure that the 'size' arg is correctly passed to the encoding reader to
prevent buffer overflows.
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r-- | Parser/tokenizer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index d7a223a..aaed637 100644 --- 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); |