From 57680a2ab43518c5ccbd8242c40482106cde6ac1 Mon Sep 17 00:00:00 2001 From: "dtucker@openbsd.org" Date: Sat, 2 Oct 2021 03:17:01 +0000 Subject: upstream: Dynamically allocate encoded HashKnownHosts and free as appropriate. Saves 1k of static storage and prevents snprintf "possible truncation" warnings from newer compilers (although in this case it's false positive since the actual sizes are limited by the output size of the SHA1). ok djm@ OpenBSD-Commit-ID: e254ae723f7e3dce352c7d5abc4b6d87faf61bf4 --- ssh-keyscan.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ssh-keyscan.c') diff --git a/ssh-keyscan.c b/ssh-keyscan.c index 7abbcbff..d688b3c3 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keyscan.c,v 1.139 2021/01/27 09:26:54 djm Exp $ */ +/* $OpenBSD: ssh-keyscan.c,v 1.140 2021/10/02 03:17:01 dtucker Exp $ */ /* * Copyright 1995, 1996 by David Mazieres . * @@ -305,8 +305,8 @@ keygrab_ssh2(con *c) static void keyprint_one(const char *host, struct sshkey *key) { - char *hostport; - const char *known_host, *hashed; + char *hostport = NULL, *hashed = NULL; + const char *known_host; found_one = 1; @@ -324,6 +324,7 @@ keyprint_one(const char *host, struct sshkey *key) fprintf(stdout, "%s ", known_host); sshkey_write(key, stdout); fputs("\n", stdout); + free(hashed); free(hostport); } -- cgit v1.2.1