[PATCH] pam_exec: fix a potential null pointer dereference
by Dmitry V. Levin
From: Daniel Abrecht <daniel.abrecht(a)hotmail.com>
Fix a null pointer dereference when pam_prompt returns PAM_SUCCESS
but the response is set to NULL.
* modules/pam_exec/pam_exec.c (call_exec): Do not invoke strndupa
with a null pointer.
Closes: https://github.com/linux-pam/linux-pam/pull/2
---
modules/pam_exec/pam_exec.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/modules/pam_exec/pam_exec.c b/modules/pam_exec/pam_exec.c
index f7de1aa..52dc681 100644
--- a/modules/pam_exec/pam_exec.c
+++ b/modules/pam_exec/pam_exec.c
@@ -177,9 +177,12 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
return retval;
}
- pam_set_item (pamh, PAM_AUTHTOK, resp);
- authtok = strndupa (resp, PAM_MAX_RESP_SIZE);
- _pam_drop (resp);
+ if (resp)
+ {
+ pam_set_item (pamh, PAM_AUTHTOK, resp);
+ authtok = strndupa (resp, PAM_MAX_RESP_SIZE);
+ _pam_drop (resp);
+ }
}
else
authtok = strndupa (void_pass, PAM_MAX_RESP_SIZE);
--
ldv
7 years, 3 months
[linux-pam] #68: Fixed null pointer dereference when pam_prompt is aborded with ctrl-d
by fedora-badges
#68: Fixed null pointer dereference when pam_prompt is aborded with ctrl-d
----------------------------+------------------------------
Reporter: danielabrecht | Owner: pam-developers@…
Type: enhancement | Status: new
Priority: minor | Component: modules
Version: | Keywords:
Blocked By: | Blocking:
----------------------------+------------------------------
The attached patch fixes a null pointer dereference when pam_prompt is
aborded with ctrl-d, addeds the options authtok=get, which assums that
authtok is already set and will never ask for a password, and authtok=ask
which always asks for the password.
--
Ticket URL: <https://fedorahosted.org/linux-pam/ticket/68>
linux-pam <http://fedorahosted.org/linux-pam>
The Linux-PAM (Pluggable Authentication Modules) project
7 years, 3 months