Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9bfcaa6

Browse files
committed
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
2 parents dd6f389 + 5962bef commit 9bfcaa6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Modules/_ssl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,8 @@ _decode_certificate(X509 *certificate) {
937937
Py_DECREF(issuer);
938938

939939
version = PyLong_FromLong(X509_get_version(certificate) + 1);
940+
if (version == NULL)
941+
goto fail0;
940942
if (PyDict_SetItemString(retval, "version", version) < 0) {
941943
Py_DECREF(version);
942944
goto fail0;

0 commit comments

Comments
 (0)