Skip to content

Commit

Permalink
gh-126106: Fix NULL possible derefrence in Modules/_ssl.c (#126111)
Browse files Browse the repository at this point in the history
Co-authored-by: Bénédikt Tran <[email protected]>
  • Loading branch information
sobolevn and picnixz authored Oct 29, 2024
1 parent 9b14083 commit a64a1c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes a possible ``NULL`` pointer dereference in :mod:`ssl`.
6 changes: 3 additions & 3 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -5424,14 +5424,14 @@ PySSLSession_dealloc(PySSLSession *self)
static PyObject *
PySSLSession_richcompare(PyObject *left, PyObject *right, int op)
{
int result;
PyTypeObject *sesstype = ((PySSLSession*)left)->ctx->state->PySSLSession_Type;

if (left == NULL || right == NULL) {
PyErr_BadInternalCall();
return NULL;
}

int result;
PyTypeObject *sesstype = ((PySSLSession*)left)->ctx->state->PySSLSession_Type;

if (!Py_IS_TYPE(left, sesstype) || !Py_IS_TYPE(right, sesstype)) {
Py_RETURN_NOTIMPLEMENTED;
}
Expand Down

0 comments on commit a64a1c9

Please sign in to comment.