diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-07-27 21:20:15 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-07-27 21:20:15 (GMT) |
commit | f1046ca8173380e2c320c56e1cdc911493371057 (patch) | |
tree | c3eabb51cc16a958e1fd1ca6700036d8b365d48b /Modules | |
parent | 4bf70686fab91dcc5603c11c36f77bd2131ff6ed (diff) | |
download | cpython-f1046ca8173380e2c320c56e1cdc911493371057.zip cpython-f1046ca8173380e2c320c56e1cdc911493371057.tar.gz cpython-f1046ca8173380e2c320c56e1cdc911493371057.tar.bz2 |
Issue #4770: Restrict binascii module to accept only bytes (as specified).
And fix the email package to encode to ASCII instead of ``raw-unicode-escape`` before ASCII-to-binary decoding.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/binascii.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c index d21404b..23ce3f0 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -546,7 +546,7 @@ binascii_a2b_hqx(PyObject *self, PyObject *args) Py_ssize_t len; int done = 0; - if ( !PyArg_ParseTuple(args, "s*:a2b_hqx", &pascii) ) + if ( !PyArg_ParseTuple(args, "y*:a2b_hqx", &pascii) ) return NULL; ascii_data = pascii.buf; len = pascii.len; @@ -750,7 +750,7 @@ binascii_rledecode_hqx(PyObject *self, PyObject *args) PyObject *rv; Py_ssize_t in_len, out_len, out_len_left; - if ( !PyArg_ParseTuple(args, "s*:rledecode_hqx", &pin) ) + if ( !PyArg_ParseTuple(args, "y*:rledecode_hqx", &pin) ) return NULL; in_data = pin.buf; in_len = pin.len; @@ -1121,7 +1121,7 @@ binascii_unhexlify(PyObject *self, PyObject *args) char* retbuf; Py_ssize_t i, j; - if (!PyArg_ParseTuple(args, "s*:a2b_hex", &parg)) + if (!PyArg_ParseTuple(args, "y*:a2b_hex", &parg)) return NULL; argbuf = parg.buf; arglen = parg.len; @@ -1199,7 +1199,7 @@ binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs) static char *kwlist[] = {"data", "header", NULL}; int header = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|i", kwlist, &pdata, + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|i", kwlist, &pdata, &header)) return NULL; data = pdata.buf; |