summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2021-10-02 03:17:01 +0000
committerDamien Miller <djm@mindrot.org>2021-10-06 14:40:32 +1100
commit57680a2ab43518c5ccbd8242c40482106cde6ac1 (patch)
treed4d1dda1c6afccb51152169a1d456deb9eff0f99 /ssh-keygen.c
parente3e62deb549fde215b777d95276c304f84bf00c6 (diff)
downloadopenssh-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-keygen.c')
-rw-r--r--ssh-keygen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 4b40768d..9b912f0a 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.437 2021/09/08 03:23:44 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.438 2021/10/02 03:17:01 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1203,6 +1203,7 @@ known_hosts_hash(struct hostkey_foreach_line *l, void *_ctx)
if ((hashed = host_hash(cp, NULL, 0)) == NULL)
fatal("hash_host failed");
fprintf(ctx->out, "%s %s\n", hashed, l->rawkey);
+ free(hashed);
ctx->has_unhashed = 1;
}
free(ohosts);