From 83b5bc967e77e4b155b1773d102c730ec112afee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Wed, 11 Jun 2014 22:36:50 +0200 Subject: [PATCH 1/5] Fix a possible NULL dereference. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit polkit_backend_session_monitor_get_user_for_subject() may return NULL (and because it is using external processes, we can’t really rule it out). The code was already anticipating NULL in the cleanup section, so handle it also when actually using the value. https://bugs.freedesktop.org/show_bug.cgi?id=80767 --- src/polkitbackend/polkitbackendinteractiveauthority.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c index 59028d5..0445148 100644 --- a/src/polkitbackend/polkitbackendinteractiveauthority.c +++ b/src/polkitbackend/polkitbackendinteractiveauthority.c @@ -559,7 +559,11 @@ log_result (PolkitBackendInteractiveAuthority *authority, user_of_subject = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor, subject, NULL); subject_str = polkit_subject_to_string (subject); - user_of_subject_str = polkit_identity_to_string (user_of_subject); + + if (user_of_subject != NULL) + user_of_subject_str = polkit_identity_to_string (user_of_subject); + else + user_of_subject_str = g_strdup (""); caller_str = polkit_subject_to_string (caller); subject_cmdline = _polkit_subject_get_cmdline (subject); -- 1.8.3.1