aboutsummaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/misc.c b/src/misc.c
index 89934900..cfd971c2 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -217,7 +217,7 @@ char *ssh_get_user_home_dir(void) {
char *szPath = NULL;
struct passwd pwd;
struct passwd *pwdbuf;
- char buf[NSS_BUFLEN_PASSWD];
+ char buf[NSS_BUFLEN_PASSWD] = {0};
int rc;
rc = getpwuid_r(getuid(), &pwd, buf, NSS_BUFLEN_PASSWD, &pwdbuf);
@@ -226,7 +226,6 @@ char *ssh_get_user_home_dir(void) {
if (szPath == NULL) {
return NULL;
}
- memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), "%s", szPath);
return strdup(buf);