Skip to content

Potential null pointer dereference in PySSLSession_richcompare #126106

Description

@federicovalenso

Bug report

Bug description:

Pointer left is dereferenced here, but null-pointer check is done later. Correct code should look like this:

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

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

CPython versions tested on:

3.11

Operating systems tested on:

No response

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13only security fixes3.14bugs and security fixeseasyextension-modulesC modules in the Modules dirtopic-SSLtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions