Skip to content

syslogmodule.c lack of NULL check #129345

Closed
Closed

Description

@wooffie

Bug description:

if (PySys_Audit("syslog.openlog", "Oll", ident ? ident : Py_None, logopt, facility) < 0) {

After in if body we use Py_DECREF(indent), which can cause null pointer dereference

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Additional information

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Reporter: Burkov Egor (eburkov@rvision.ru).

Organization: R-Vision (support@rvision.ru).

Linked PRs

Activity

  1. serhiy-storchaka commented on Jan 27, 2025

    @serhiy-storchaka
    Member

    Do you want to provide a PR?

  2. wooffie commented on Jan 27, 2025

    @wooffie
    ContributorAuthor

    Do you want to provide a PR?

    yes, sure

  3. added 2 commits that reference this issue on Jan 27, 2025
  4. ZeroIntensity commented on Jan 27, 2025

    @ZeroIntensity
    Member

    Quick reproducer for a test case:

    import syslog
    import sys
    
    sys.argv = None
    def audit(event, _):
        if event == "syslog.openlog":
            raise RuntimeError("I didn't expect the spanish inquisition")
    
    sys.addaudithook(audit)
    syslog.openlog()
  5. added a commit that references this issue on Jan 29, 2025
  6. added 2 commits that reference this issue on Jan 29, 2025
  7. added 2 commits that reference this issue on Feb 3, 2025
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 dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions