From: Christian Heimes Date: Fri, 26 Jul 2013 13:51:18 +0000 (+0200) Subject: Check return value of PyLong_FromLong(X509_get_version()). It might be NULL if X-Git-Tag: v3.4.0a1~76^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5962bef8aa1b711c558d92c428c122717ddb5228;p=python Check return value of PyLong_FromLong(X509_get_version()). It might be NULL if X509_get_version() grows beyond our small int cache. CID 1058279 --- diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 434729fa9a..848b9621b4 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -903,6 +903,8 @@ _decode_certificate(X509 *certificate) { Py_DECREF(issuer); version = PyLong_FromLong(X509_get_version(certificate) + 1); + if (version == NULL) + goto fail0; if (PyDict_SetItemString(retval, "version", version) < 0) { Py_DECREF(version); goto fail0;