diff options
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 e692b5dfa6..195e5b6491 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -1005,6 +1005,7 @@ PySSL_peercert(PySSLObject *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; @@ -1012,7 +1013,10 @@ PySSL_peercert(PySSLObject *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; |