Skip to content

Commit e2c1884

Browse files
miss-islingtonsobolevnpicnixz
authored
[3.13] gh-126106: Fix NULL possible derefrence in Modules/_ssl.c (GH-126111) (#126116)
gh-126106: Fix `NULL` possible derefrence in `Modules/_ssl.c` (GH-126111) (cherry picked from commit a64a1c9) Co-authored-by: sobolevn <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]>
1 parent e7c6310 commit e2c1884

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
@@ -5206,14 +5206,14 @@ PySSLSession_dealloc(PySSLSession *self)
52065206
static PyObject *
52075207
PySSLSession_richcompare(PyObject *left, PyObject *right, int op)
52085208
{
5209-
int result;
5210-
PyTypeObject *sesstype = ((PySSLSession*)left)->ctx->state->PySSLSession_Type;
5211-
52125209
if (left == NULL || right == NULL) {
52135210
PyErr_BadInternalCall();
52145211
return NULL;
52155212
}
52165213

5214+
int result;
5215+
PyTypeObject *sesstype = ((PySSLSession*)left)->ctx->state->PySSLSession_Type;
5216+
52175217
if (!Py_IS_TYPE(left, sesstype) || !Py_IS_TYPE(right, sesstype)) {
52185218
Py_RETURN_NOTIMPLEMENTED;
52195219
}

0 commit comments

Comments
 (0)