Skip to content

Commit a64a1c9

Browse files
sobolevnpicnixz
andauthored
gh-126106: Fix NULL possible derefrence in Modules/_ssl.c (#126111)
Co-authored-by: Bénédikt Tran <[email protected]>
1 parent 9b14083 commit a64a1c9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes a possible ``NULL`` pointer dereference in :mod:`ssl`.

Modules/_ssl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5424,14 +5424,14 @@ PySSLSession_dealloc(PySSLSession *self)
54245424
static PyObject *
54255425
PySSLSession_richcompare(PyObject *left, PyObject *right, int op)
54265426
{
5427-
int result;
5428-
PyTypeObject *sesstype = ((PySSLSession*)left)->ctx->state->PySSLSession_Type;
5429-
54305427
if (left == NULL || right == NULL) {
54315428
PyErr_BadInternalCall();
54325429
return NULL;
54335430
}
54345431

5432+
int result;
5433+
PyTypeObject *sesstype = ((PySSLSession*)left)->ctx->state->PySSLSession_Type;
5434+
54355435
if (!Py_IS_TYPE(left, sesstype) || !Py_IS_TYPE(right, sesstype)) {
54365436
Py_RETURN_NOTIMPLEMENTED;
54375437
}

0 commit comments

Comments
 (0)