1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-30 13:01:23 +03:00

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 <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
Jakub Jelen
2022-02-03 11:23:14 +01:00
parent ea83a27371
commit 24ac4a0129

View File

@@ -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;