diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2021-10-02 03:17:01 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2021-10-06 14:40:32 +1100 |
commit | 57680a2ab43518c5ccbd8242c40482106cde6ac1 (patch) | |
tree | d4d1dda1c6afccb51152169a1d456deb9eff0f99 /ssh-keyscan.c | |
parent | e3e62deb549fde215b777d95276c304f84bf00c6 (diff) | |
download | openssh-git-57680a2ab43518c5ccbd8242c40482106cde6ac1.tar.gz |
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
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r-- | ssh-keyscan.c | 7 |
1 files changed, 4 insertions, 3 deletions
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 <dm@lcs.mit.edu>. * @@ -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); } |