From 5f51dcfa6b804025ed002fe06a0534316d471c0c Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Tue, 2 Jan 2024 21:14:23 +0100 Subject: pam_unix: use calloc instead of malloc/memset Signed-off-by: Tobias Stoeckmann --- modules/pam_unix/support.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules/pam_unix') diff --git a/modules/pam_unix/support.c b/modules/pam_unix/support.c index bdba3ce5..aa7000b3 100644 --- a/modules/pam_unix/support.c +++ b/modules/pam_unix/support.c @@ -444,11 +444,10 @@ int _unix_getpwnam(pam_handle_t *pamh, const char *name, strlen(sgecos) + 1 + strlen(shome) + 1 + strlen(sshell) + 1; - *ret = malloc(retlen); + *ret = calloc(retlen, sizeof(char)); if (*ret == NULL) { return matched; } - memset(*ret, '\0', retlen); (*ret)->pw_uid = strtol(suid, &p, 10); if ((strlen(suid) == 0) || (*p != '\0')) { -- cgit v1.2.3