From 24ac4a01296c0e70dd0d6285352757d02d4209a1 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 3 Feb 2022 11:23:14 +0100 Subject: [PATCH] misc: Initialize the host buffer This fails if the gethostname() fails in a way that does not write the buffer, but returns 0 as a success. Fixes #106 Thanks oss-fuzz Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider Reviewed-by: Sahana Prasad --- src/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/misc.c b/src/misc.c index 97c3a0ef..c7e3cfc9 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1104,7 +1104,7 @@ char *ssh_path_expand_tilde(const char *d) { * @returns Expanded string. */ char *ssh_path_expand_escape(ssh_session session, const char *s) { - char host[NI_MAXHOST]; + char host[NI_MAXHOST] = {0}; char *buf = NULL; char *r = NULL; char *x = NULL;