aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2023-12-15 10:13:23 +0100
committerDmitry V. Levin <ldv@strace.io>2023-12-19 12:22:59 +0000
commit6834e0dd1dcae917caa464d1fe124c2f6c6116f4 (patch)
tree8daad0e1ec012dda888b42c58561f451675ed275 /modules
parent8e95e2af01b5880b37b17bb23b4c187a88046bdf (diff)
downloadpam-6834e0dd1dcae917caa464d1fe124c2f6c6116f4.tar.gz
pam-6834e0dd1dcae917caa464d1fe124c2f6c6116f4.tar.bz2
pam-6834e0dd1dcae917caa464d1fe124c2f6c6116f4.zip
pam_xauth: check strdup return value
Treat NULL as error just as if cookiefile is constructed manually. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'modules')
-rw-r--r--modules/pam_xauth/pam_xauth.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/pam_xauth/pam_xauth.c b/modules/pam_xauth/pam_xauth.c
index d5e99c9f..ed86130e 100644
--- a/modules/pam_xauth/pam_xauth.c
+++ b/modules/pam_xauth/pam_xauth.c
@@ -501,6 +501,10 @@ pam_sm_open_session (pam_handle_t *pamh, int flags UNUSED,
/* Figure out where the source user's .Xauthority file is. */
if (getenv(XAUTHENV) != NULL) {
cookiefile = strdup(getenv(XAUTHENV));
+ if (cookiefile == NULL) {
+ retval = PAM_SESSION_ERR;
+ goto cleanup;
+ }
} else {
cookiefile = malloc(strlen(rpwd->pw_dir) + 1 +
strlen(XAUTHDEF) + 1);