diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-08-15 21:18:25 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-08-15 21:18:25 (GMT) |
commit | 6f430e496339aea3e688165340456b555d5e1035 (patch) | |
tree | 197393decf924def07e006f3e35cf21f2fec0f08 /Modules/_ssl.c | |
parent | dd7c55250d67de4d430a0c51dba4f3c0cd8f6ed3 (diff) | |
download | cpython-6f430e496339aea3e688165340456b555d5e1035.zip cpython-6f430e496339aea3e688165340456b555d5e1035.tar.gz cpython-6f430e496339aea3e688165340456b555d5e1035.tar.bz2 |
Issue #15604: Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Modules/_ssl.c')
-rw-r--r-- | Modules/_ssl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 3fa2d6a..0a84118 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -883,6 +883,7 @@ PySSL_peercert(PySSLSocket *self, PyObject *args) int len; int verification; PyObject *binary_mode = Py_None; + int b; if (!PyArg_ParseTuple(args, "|O:peer_certificate", &binary_mode)) return NULL; @@ -890,7 +891,10 @@ PySSL_peercert(PySSLSocket *self, PyObject *args) if (!self->peer_cert) Py_RETURN_NONE; - if (PyObject_IsTrue(binary_mode)) { + b = PyObject_IsTrue(binary_mode); + if (b < 0) + return NULL; + if (b) { /* return cert in DER-encoded format */ unsigned char *bytes_buf = NULL; |