aboutsummaryrefslogtreecommitdiff
path: root/modules/pam_namespace/pam_namespace.c
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_namespace/pam_namespace.c
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_namespace/pam_namespace.c')
-rw-r--r--modules/pam_namespace/pam_namespace.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c
index 6937b6ac..d78111b3 100644
--- a/modules/pam_namespace/pam_namespace.c
+++ b/modules/pam_namespace/pam_namespace.c
@@ -1295,13 +1295,12 @@ static int check_inst_parent(char *ipath, struct instance_data *idata)
* admin explicitly instructs to ignore the instance parent
* mode by the "ignore_instance_parent_mode" argument).
*/
- inst_parent = malloc(strlen(ipath)+1);
+ inst_parent = strdup(ipath);
if (!inst_parent) {
pam_syslog(idata->pamh, LOG_CRIT, "Error allocating pathname string");
return PAM_SESSION_ERR;
}
- strcpy(inst_parent, ipath);
trailing_slash = strrchr(inst_parent, '/');
if (trailing_slash)
*trailing_slash = '\0';