]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: avoid printf("%s", NULL) if using ssh
authordjm@openbsd.org <djm@openbsd.org>
Fri, 13 Jan 2023 02:44:02 +0000 (02:44 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 13 Jan 2023 03:06:37 +0000 (14:06 +1100)
-oUserKnownHostsFile=none and a hostkey in one of the system known hosts file
changes; ok dtucker@

OpenBSD-Commit-ID: 7ca87614bfc6da491315536a7f2301434a9fe614

sshconnect.c

index 0fca52b220ff0187b8f27406c78ca3df4c1cc4a5..792bc34bcb921609bd6cd529e5e98ee06cdf6522 100644 (file)
@@ -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@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@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);