diff options
Diffstat (limited to 'Modules/clinic/_cryptmodule.c.h')
-rw-r--r-- | Modules/clinic/_cryptmodule.c.h | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/Modules/clinic/_cryptmodule.c.h b/Modules/clinic/_cryptmodule.c.h index baa31e2..2fcb0c1 100644 --- a/Modules/clinic/_cryptmodule.c.h +++ b/Modules/clinic/_cryptmodule.c.h @@ -26,8 +26,33 @@ crypt_crypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs) const char *word; const char *salt; - if (!_PyArg_ParseStack(args, nargs, "ss:crypt", - &word, &salt)) { + if (!_PyArg_CheckPositional("crypt", nargs, 2, 2)) { + goto exit; + } + if (!PyUnicode_Check(args[0])) { + _PyArg_BadArgument("crypt", 1, "str", args[0]); + goto exit; + } + Py_ssize_t word_length; + word = PyUnicode_AsUTF8AndSize(args[0], &word_length); + if (word == NULL) { + goto exit; + } + if (strlen(word) != (size_t)word_length) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); + goto exit; + } + if (!PyUnicode_Check(args[1])) { + _PyArg_BadArgument("crypt", 2, "str", args[1]); + goto exit; + } + Py_ssize_t salt_length; + salt = PyUnicode_AsUTF8AndSize(args[1], &salt_length); + if (salt == NULL) { + goto exit; + } + if (strlen(salt) != (size_t)salt_length) { + PyErr_SetString(PyExc_ValueError, "embedded null character"); goto exit; } return_value = crypt_crypt_impl(module, word, salt); @@ -35,4 +60,4 @@ crypt_crypt(PyObject *module, PyObject *const *args, Py_ssize_t nargs) exit: return return_value; } -/*[clinic end generated code: output=79001dbfdd623ff9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3f75d4d4be4dddbb input=a9049054013a1b77]*/ |