[openssh-commits] [openssh] 02/03: upstream: Slot 0 in the hostbased key array was previously RSA1,
git+noreply at mindrot.org
git+noreply at mindrot.org
Thu Jul 19 21:41:50 AEST 2018
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit ac590760b251506b0a152551abbf8e8d6dc2f527
Author: dtucker at openbsd.org <dtucker at openbsd.org>
Date: Mon Jul 16 22:25:01 2018 +0000
upstream: Slot 0 in the hostbased key array was previously RSA1,
but that is now gone and the slot is unused so remove it. Remove two
now-unused macros, and add an array bounds check to the two remaining ones
(array is statically sized, so mostly a safety check on future changes). ok
markus@
OpenBSD-Commit-ID: 2e4c0ca6cc1d8daeccead2aa56192a3f9d5e1e7a
---
ssh.c | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/ssh.c b/ssh.c
index 33d7ea2b..609c209d 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.485 2018/07/16 11:05:41 dtucker Exp $ */
+/* $OpenBSD: ssh.c,v 1.486 2018/07/16 22:25:01 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1418,34 +1418,34 @@ main(int ac, char **av)
sensitive_data.nkeys = 0;
sensitive_data.keys = NULL;
if (options.hostbased_authentication) {
- sensitive_data.nkeys = 11;
+ sensitive_data.nkeys = 10;
sensitive_data.keys = xcalloc(sensitive_data.nkeys,
sizeof(struct sshkey));
/* XXX check errors? */
-#define L_KEY(t,p,o) \
- check_load(sshkey_load_private_type(t, p, "", \
- &(sensitive_data.keys[o]), NULL, NULL), p, "key")
-#define L_KEYCERT(t,p,o) \
- check_load(sshkey_load_private_cert(t, p, "", \
- &(sensitive_data.keys[o]), NULL), p, "cert and key")
-#define L_PUBKEY(p,o) \
+#define L_PUBKEY(p,o) do { \
+ if ((o) >= sensitive_data.nkeys) \
+ fatal("%s pubkey out of array bounds", __func__); \
check_load(sshkey_load_public(p, &(sensitive_data.keys[o]), NULL), \
- p, "pubkey")
-#define L_CERT(p,o) \
- check_load(sshkey_load_cert(p, &(sensitive_data.keys[o])), p, "cert")
+ p, "pubkey"); \
+} while (0)
+#define L_CERT(p,o) do { \
+ if ((o) >= sensitive_data.nkeys) \
+ fatal("%s cert out of array bounds", __func__); \
+ check_load(sshkey_load_cert(p, &(sensitive_data.keys[o])), p, "cert"); \
+} while (0)
if (options.hostbased_authentication == 1) {
- L_CERT(_PATH_HOST_ECDSA_KEY_FILE, 1);
- L_CERT(_PATH_HOST_ED25519_KEY_FILE, 2);
- L_CERT(_PATH_HOST_RSA_KEY_FILE, 3);
- L_CERT(_PATH_HOST_DSA_KEY_FILE, 4);
- L_PUBKEY(_PATH_HOST_ECDSA_KEY_FILE, 5);
- L_PUBKEY(_PATH_HOST_ED25519_KEY_FILE, 6);
- L_PUBKEY(_PATH_HOST_RSA_KEY_FILE, 7);
- L_PUBKEY(_PATH_HOST_DSA_KEY_FILE, 8);
- L_CERT(_PATH_HOST_XMSS_KEY_FILE, 9);
- L_PUBKEY(_PATH_HOST_XMSS_KEY_FILE, 10);
+ L_CERT(_PATH_HOST_ECDSA_KEY_FILE, 0);
+ L_CERT(_PATH_HOST_ED25519_KEY_FILE, 1);
+ L_CERT(_PATH_HOST_RSA_KEY_FILE, 2);
+ L_CERT(_PATH_HOST_DSA_KEY_FILE, 3);
+ L_PUBKEY(_PATH_HOST_ECDSA_KEY_FILE, 4);
+ L_PUBKEY(_PATH_HOST_ED25519_KEY_FILE, 5);
+ L_PUBKEY(_PATH_HOST_RSA_KEY_FILE, 6);
+ L_PUBKEY(_PATH_HOST_DSA_KEY_FILE, 7);
+ L_CERT(_PATH_HOST_XMSS_KEY_FILE, 8);
+ L_PUBKEY(_PATH_HOST_XMSS_KEY_FILE, 9);
}
}
/*
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list