[openssh-commits] [openssh] 01/03: upstream: don't print key if printing hostname failed; with/ok

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Mar 31 15:32:58 AEDT 2023


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 1883841fc13d0eada8743cac5d3abe142ee2efa7
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Mar 31 04:21:56 2023 +0000

    upstream: don't print key if printing hostname failed; with/ok
    
    dtucker@
    
    OpenBSD-Commit-ID: ad42971a6ee5a46feab2d79f7f656f8cf4b119f3
---
 ssh-keyscan.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 3f3092e6..a53188c7 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.151 2023/02/10 06:41:53 jmc Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.152 2023/03/31 04:21:56 djm Exp $ */
 /*
  * Copyright 1995, 1996 by David Mazieres <dm at lcs.mit.edu>.
  *
@@ -313,6 +313,7 @@ keyprint_one(const char *host, struct sshkey *key)
 {
 	char *hostport = NULL, *hashed = NULL;
 	const char *known_host;
+	int r = 0;
 
 	found_one = 1;
 
@@ -327,9 +328,9 @@ keyprint_one(const char *host, struct sshkey *key)
 		fatal("host_hash failed");
 	known_host = hash_hosts ? hashed : hostport;
 	if (!get_cert)
-		fprintf(stdout, "%s ", known_host);
-	sshkey_write(key, stdout);
-	fputs("\n", stdout);
+		r = fprintf(stdout, "%s ", known_host);
+	if (r >= 0 && sshkey_write(key, stdout) == 0)
+		(void)fputs("\n", stdout);
 	free(hashed);
 	free(hostport);
 }

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list