aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-09-03 18:09:02 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-09-04 19:59:01 +0200
commitd1cd914012ecb16ee99f0c2876bb16f7c2c666a8 (patch)
tree262fc9cef2aac35c4fdfe212de9a6bdf98e3d756 /src
parentc3980d433a02f00e2a4915278b90dfef804307a4 (diff)
downloadlibssh-d1cd914012ecb16ee99f0c2876bb16f7c2c666a8.tar.gz
libssh-d1cd914012ecb16ee99f0c2876bb16f7c2c666a8.tar.xz
libssh-d1cd914012ecb16ee99f0c2876bb16f7c2c666a8.zip
misc: Use C99 initializer to initialize string
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'src')
-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);