summaryrefslogtreecommitdiffstats
path: root/Modules/_cryptmodule.c
diff options
context:
space:
mode:
authorAntonio Gutierrez <chibby0ne@gmail.com>2019-10-08 04:22:17 (GMT)
committerBenjamin Peterson <benjamin@python.org>2019-10-08 04:22:17 (GMT)
commit0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c (patch)
tree8ddcbaae6fdebf3694b166b58995aa849b812f3d /Modules/_cryptmodule.c
parent4d5f94b8cd20f804c7868c5395a15aa6032f874c (diff)
downloadcpython-0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c.zip
cpython-0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c.tar.gz
cpython-0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c.tar.bz2
closes bpo-38402: Check error of primitive crypt/crypt_r. (GH-16599)
Checks also for encryption algorithms methods not supported in different OSs. Signed-off-by: Antonio Gutierrez <chibby0ne@gmail.com>
Diffstat (limited to 'Modules/_cryptmodule.c')
-rw-r--r--Modules/_cryptmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c
index 5d03f45..00c1f4f 100644
--- a/Modules/_cryptmodule.c
+++ b/Modules/_cryptmodule.c
@@ -42,6 +42,9 @@ crypt_crypt_impl(PyObject *module, const char *word, const char *salt)
#else
crypt_result = crypt(word, salt);
#endif
+ if (crypt_result == NULL) {
+ return PyErr_SetFromErrno(PyExc_OSError);
+ }
return Py_BuildValue("s", crypt_result);
}