aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-pam/musl-fix-pam_exec.patch
blob: 760660fa0c267c89d67fd3bb3dfb09480ae0d56e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff --git a/modules/pam_exec/pam_exec.c b/modules/pam_exec/pam_exec.c
index 52dc681..4ed6e34 100644
--- a/modules/pam_exec/pam_exec.c
+++ b/modules/pam_exec/pam_exec.c
@@ -103,11 +103,14 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
   int optargc;
   const char *logfile = NULL;
   const char *authtok = NULL;
+  char authtok_buf[PAM_MAX_RESP_SIZE+1];
+
   pid_t pid;
   int fds[2];
   int stdout_fds[2];
   FILE *stdout_file = NULL;
 
+  memset(authtok_buf, 0, sizeof(authtok_buf));
   if (argc < 1) {
     pam_syslog (pamh, LOG_ERR,
 		"This module needs at least one argument");
@@ -180,12 +183,12 @@ call_exec (const char *pam_type, pam_handle_t *pamh,
 	      if (resp)
 		{
 		  pam_set_item (pamh, PAM_AUTHTOK, resp);
-		  authtok = strndupa (resp, PAM_MAX_RESP_SIZE);
+		  authtok = strncpy(authtok_buf, resp, sizeof(authtok_buf));
 		  _pam_drop (resp);
 		}
 	    }
 	  else
-	    authtok = strndupa (void_pass, PAM_MAX_RESP_SIZE);
+	    authtok = strncpy(authtok_buf, void_pass, sizeof(authtok_buf));
 
 	  if (pipe(fds) != 0)
 	    {