summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2009-02-12 03:26:23 +0000
committerDamien Miller <djm@cvs.openbsd.org>2009-02-12 03:26:23 +0000
commit51b996defee642386dba18d69aedfe581a9f5207 (patch)
tree51bed324e59240b172ceaa1741a8a39f4724b33f /usr.bin
parent6f412ac63e3a9cf8abd29c8e34d4b3ae5167f5ea (diff)
some paranoia: check that the serialised key is really KEY_RSA before
diddling its internals
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/monitor.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ssh/monitor.c b/usr.bin/ssh/monitor.c
index 683c5ad3243..433555f00c4 100644
--- a/usr.bin/ssh/monitor.c
+++ b/usr.bin/ssh/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.100 2008/11/04 08:22:13 djm Exp $ */
+/* $OpenBSD: monitor.c,v 1.101 2009/02/12 03:26:22 djm Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -1227,7 +1227,9 @@ mm_answer_rsa_challenge(int sock, Buffer *m)
fatal("%s: key type mismatch", __func__);
if ((key = key_from_blob(blob, blen)) == NULL)
fatal("%s: received bad key", __func__);
-
+ if (key->type != KEY_RSA)
+ fatal("%s: received bad key type %d", __func__, key->type);
+ key->type = KEY_RSA1;
if (ssh1_challenge)
BN_clear_free(ssh1_challenge);
ssh1_challenge = auth_rsa_generate_challenge(key);