diff options
author | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 15:05:40 -0800 |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2017-02-04 15:05:40 -0800 |
commit | b2fa705fd3887c326e811c418469c784353027f4 (patch) | |
tree | b3428f73de91453edbfd4df1a5d4a212d182eb44 /Modules/clinic/md5module.c.h | |
parent | 134e58fd3aaa2e91390041e143f3f0a21a60142b (diff) | |
parent | b53654b6dbfce8318a7d4d1cdaddca7a7fec194b (diff) | |
download | cpython-b2fa705fd3887c326e811c418469c784353027f4.tar.gz |
Issue #29392: Prevent crash when passing invalid arguments into msvcrt module.
Diffstat (limited to 'Modules/clinic/md5module.c.h')
-rw-r--r-- | Modules/clinic/md5module.c.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Modules/clinic/md5module.c.h b/Modules/clinic/md5module.c.h index 0bd958ac6e..a841fe5786 100644 --- a/Modules/clinic/md5module.c.h +++ b/Modules/clinic/md5module.c.h @@ -72,24 +72,26 @@ PyDoc_STRVAR(_md5_md5__doc__, "Return a new MD5 hash object; optionally initialized with a string."); #define _MD5_MD5_METHODDEF \ - {"md5", (PyCFunction)_md5_md5, METH_VARARGS|METH_KEYWORDS, _md5_md5__doc__}, + {"md5", (PyCFunction)_md5_md5, METH_FASTCALL, _md5_md5__doc__}, static PyObject * _md5_md5_impl(PyObject *module, PyObject *string); static PyObject * -_md5_md5(PyObject *module, PyObject *args, PyObject *kwargs) +_md5_md5(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - static char *_keywords[] = {"string", NULL}; + static const char * const _keywords[] = {"string", NULL}; + static _PyArg_Parser _parser = {"|O:md5", _keywords, 0}; PyObject *string = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:md5", _keywords, - &string)) + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + &string)) { goto exit; + } return_value = _md5_md5_impl(module, string); exit: return return_value; } -/*[clinic end generated code: output=4cd3cc96e35563d2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=54cd50db050f2589 input=a9049054013a1b77]*/ |