[Python-checkins] cpython (3.3): Check return value of PyLong_FromLong(X509_get_version()). It might be NULL if

christian.heimes python-checkins at python.org
Fri Jul 26 15:51:42 CEST 2013


http://hg.python.org/cpython/rev/7d6781ec35ea
changeset:   84838:7d6781ec35ea
branch:      3.3
parent:      84836:e6e9e237cc6b
user:        Christian Heimes <christian at cheimes.de>
date:        Fri Jul 26 15:51:18 2013 +0200
summary:
  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

files:
  Modules/_ssl.c |  2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -903,6 +903,8 @@
     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;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list