From 6985b4be9b01f3c6d581a93e58f5b14adb793d92 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Tue, 4 Feb 2025 00:24:56 +0100 Subject: [PATCH] [3.12] gh-129345: null check for indent syslogmodule (GH-129348) (#129443) gh-129345: null check for indent syslogmodule (GH-129348) (cherry picked from commit 25cf79a0829422bd8479ca0c13c72b769422077b) Co-authored-by: Burkov Egor --- .../2025-01-28-06-23-59.gh-issue-129345.uOjkML.rst | 1 + Modules/syslogmodule.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2025-01-28-06-23-59.gh-issue-129345.uOjkML.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-01-28-06-23-59.gh-issue-129345.uOjkML.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-01-28-06-23-59.gh-issue-129345.uOjkML.rst new file mode 100644 index 000000000000..68e1103db456 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-01-28-06-23-59.gh-issue-129345.uOjkML.rst @@ -0,0 +1 @@ +Fix null pointer dereference in :func:`syslog.openlog` when an audit hook raises an exception. diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index 722364e0751d..c925a42dc05c 100644 --- a/Modules/syslogmodule.c +++ b/Modules/syslogmodule.c @@ -170,7 +170,7 @@ syslog_openlog_impl(PyObject *module, PyObject *ident, long logopt, } } if (PySys_Audit("syslog.openlog", "Oll", ident ? ident : Py_None, logopt, facility) < 0) { - Py_DECREF(ident); + Py_XDECREF(ident); return NULL; } -- 2.47.3