From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Wed, 11 Jun 2014 22:36:50 +0200 Subject: [PATCH] 0.113: 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. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80767 Origin: upstream, 0.113, commit:6109543303def367b84eaac97d2ff9cefe735efb Imported from policykit-1_0.105-25.debian.tar.xz Signed-off-by: Michael Olbrich --- 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 25e13fb0907e..00ee0446445f 100644 --- a/src/polkitbackend/polkitbackendinteractiveauthority.c +++ b/src/polkitbackend/polkitbackendinteractiveauthority.c @@ -557,7 +557,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);