[openssh-commits] [openssh] 03/04: upstream: avoid printf("%s", NULL) if using ssh

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Jan 13 14:10:10 AEDT 2023


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

dtucker pushed a commit to branch master
in repository openssh.

commit f673b49f3be3eb51074fbb8a405beb6cd0f7d93e
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Jan 13 02:44:02 2023 +0000

    upstream: avoid printf("%s", NULL) if using ssh
    
    -oUserKnownHostsFile=none and a hostkey in one of the system known hosts file
    changes; ok dtucker@
    
    OpenBSD-Commit-ID: 7ca87614bfc6da491315536a7f2301434a9fe614
---
 sshconnect.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sshconnect.c b/sshconnect.c
index 0fca52b2..792bc34b 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.c,v 1.360 2022/11/03 21:59:20 djm Exp $ */
+/* $OpenBSD: sshconnect.c,v 1.361 2023/01/13 02:44:02 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1276,8 +1276,11 @@ check_host_key(char *hostname, const struct ssh_conn_info *cinfo,
 		}
 		/* The host key has changed. */
 		warn_changed_key(host_key);
-		error("Add correct host key in %.100s to get rid of this message.",
-		    user_hostfiles[0]);
+		if (num_user_hostfiles > 0 || num_system_hostfiles > 0) {
+			error("Add correct host key in %.100s to get rid "
+			    "of this message.", num_user_hostfiles > 0 ?
+			    user_hostfiles[0] : system_hostfiles[0]);
+		}
 		error("Offending %s key in %s:%lu",
 		    sshkey_type(host_found->key),
 		    host_found->file, host_found->line);

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


More information about the openssh-commits mailing list