Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syslogmodule.c lack of NULL check #129345

Closed
wooffie opened this issue Jan 27, 2025 · 3 comments
Closed

syslogmodule.c lack of NULL check #129345

wooffie opened this issue Jan 27, 2025 · 3 comments
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes easy extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@wooffie
Copy link
Contributor

wooffie commented Jan 27, 2025

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 ([email protected]).

Organization: R-Vision ([email protected]).

Linked PRs

@wooffie wooffie added the type-bug An unexpected behavior, bug, or error label Jan 27, 2025
@serhiy-storchaka serhiy-storchaka added easy 3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Jan 27, 2025
@serhiy-storchaka
Copy link
Member

Do you want to provide a PR?

@wooffie
Copy link
Contributor Author

wooffie commented Jan 27, 2025

Do you want to provide a PR?

yes, sure

@ZeroIntensity
Copy link
Member

ZeroIntensity commented Jan 27, 2025

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()

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 29, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 29, 2025
@picnixz picnixz added the extension-modules C modules in the Modules dir label Jan 31, 2025
Yhg1s pushed a commit that referenced this issue Feb 3, 2025
…9443)

gh-129345: null check for indent syslogmodule (GH-129348)
(cherry picked from commit 25cf79a)

Co-authored-by: Burkov Egor <[email protected]>
Yhg1s pushed a commit that referenced this issue Feb 3, 2025
…9442)

gh-129345: null check for indent syslogmodule (GH-129348)
(cherry picked from commit 25cf79a)

Co-authored-by: Burkov Egor <[email protected]>
@picnixz picnixz closed this as completed Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes easy extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants