summaryrefslogtreecommitdiff
path: root/modules/pam_selinux
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-03-23 19:54:00 +0100
committerChristian Göttsche <cgzones@googlemail.com>2020-03-23 19:54:00 +0100
commitd1963687081754796ab643569a882ba6636a44c6 (patch)
treed0396fa3b6aa46ba8b1835a956905a7196f8c645 /modules/pam_selinux
parentfbc66d1cdbbb4bd3abd98b84b51be05f4b061d95 (diff)
pam_selinux: sanitize asprintf argument on failure
Diffstat (limited to 'modules/pam_selinux')
-rw-r--r--modules/pam_selinux/pam_selinux.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/pam_selinux/pam_selinux.c b/modules/pam_selinux/pam_selinux.c
index 57b02bac..5b7dd277 100644
--- a/modules/pam_selinux/pam_selinux.c
+++ b/modules/pam_selinux/pam_selinux.c
@@ -103,6 +103,7 @@ send_audit_message(pam_handle_t *pamh, int success, const char *default_context,
if (asprintf(&msg, "pam: default-context=%s selected-context=%s",
default_raw ? default_raw : (default_context ? default_context : "?"),
selected_raw ? selected_raw : (selected_context ? selected_context : "?")) < 0) {
+ msg = NULL; /* asprintf leaves msg in undefined state on failure */
pam_syslog(pamh, LOG_ERR, "Error allocating memory.");
goto out;
}