aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-03-26 15:45:43 +0200
committerAndreas Schneider <asn@samba.org>2018-03-26 19:11:11 +0200
commit19a77f8ab6978d48ecfe560ac2221b581628f699 (patch)
treec4cd287c9e5b74cbdd0e4cdf0e0c197ae771c9f0
parenta15c28edf44c580e5c8c44b57951addcd79e145f (diff)
downloadpam_wrapper-19a77f8ab6978d48ecfe560ac2221b581628f699.tar.gz
pam_wrapper-19a77f8ab6978d48ecfe560ac2221b581628f699.tar.xz
pam_wrapper-19a77f8ab6978d48ecfe560ac2221b581628f699.zip
pwrap: Avoid strncpy in pwrap_init()
CID 47508 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r--src/pam_wrapper.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c
index 482b388..1bb3161 100644
--- a/src/pam_wrapper.c
+++ b/src/pam_wrapper.c
@@ -908,11 +908,13 @@ static void pwrap_init(void)
"%s",
pam_library);
} else {
- char libpam_path_cp[sizeof(libpam_path)];
- char *dname;
+ char libpam_path_cp[1024] = {0};
+ char *dname = NULL;
- strncpy(libpam_path_cp, libpam_path, sizeof(libpam_path_cp));
- libpam_path_cp[sizeof(libpam_path_cp) - 1] = '\0';
+ snprintf(libpam_path_cp,
+ sizeof(libpam_path_cp),
+ "%s",
+ libpam_path);
dname = dirname(libpam_path_cp);
if (dname == NULL) {