aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_listfile
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@stoeckmann.org>2023-12-15 10:14:11 +0100
committerDmitry V. Levin <ldv@strace.io>2023-12-19 12:22:59 +0000
commitc2fafe1be0fb72aa1bd521efe2f524074bf143c7 (patch)
tree0790beda071109b1c0ef9397d442ff641f7077c9 /modules/pam_listfile
parent6834e0dd1dcae917caa464d1fe124c2f6c6116f4 (diff)
downloadpam-c2fafe1be0fb72aa1bd521efe2f524074bf143c7.tar.gz
pam-c2fafe1be0fb72aa1bd521efe2f524074bf143c7.tar.bz2
pam-c2fafe1be0fb72aa1bd521efe2f524074bf143c7.zip
treewide: replace malloc followed by strcpy with strdup
Suggested-by: Benny Baumann <BenBE@geshi.org> Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Diffstat (limited to 'modules/pam_listfile')
-rw-r--r--modules/pam_listfile/pam_listfile.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/modules/pam_listfile/pam_listfile.c b/modules/pam_listfile/pam_listfile.c
index a01b5a8a..3e6a7092 100644
--- a/modules/pam_listfile/pam_listfile.c
+++ b/modules/pam_listfile/pam_listfile.c
@@ -106,10 +106,9 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
}
else if(!strcmp(mybuf,"file")) {
free(ifname);
- ifname = malloc(strlen(myval)+1);
+ ifname = strdup(myval);
if (!ifname)
return PAM_BUF_ERR;
- strcpy(ifname,myval);
} else if(!strcmp(mybuf,"item"))
if(!strcmp(myval,"user"))
citem = PAM_USER;