summaryrefslogtreecommitdiff
path: root/sshconnect1.c
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2017-03-10 03:53:11 +0000
committerDamien Miller <djm@mindrot.org>2017-03-10 15:35:39 +1100
commit66be4fe8c4435af5bbc82998501a142a831f1181 (patch)
tree47941cca30c96b46aab469a960e9cdd5ec340509 /sshconnect1.c
parentec2892b5c7fea199914cb3a6afb3af38f84990bf (diff)
upstream commit
Check for NULL return value from key_new. Patch from jjelen at redhat.com via bz#2687, ok djm@ Upstream-ID: 059e33cd43cba88dc8caf0b1936fd4dd88fd5b8e
Diffstat (limited to 'sshconnect1.c')
-rw-r--r--sshconnect1.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sshconnect1.c b/sshconnect1.c
index a0453618..dc00b4cd 100644
--- a/sshconnect1.c
+++ b/sshconnect1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect1.c,v 1.79 2016/09/19 07:52:42 natano Exp $ */
+/* $OpenBSD: sshconnect1.c,v 1.80 2017/03/10 03:53:11 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -520,7 +520,8 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
cookie[i] = packet_get_char();
/* Get the public key. */
- server_key = key_new(KEY_RSA1);
+ if ((server_key = key_new(KEY_RSA1)) == NULL)
+ fatal("%s: key_new(KEY_RSA1) failed", __func__);
bits = packet_get_int();
packet_get_bignum(server_key->rsa->e);
packet_get_bignum(server_key->rsa->n);
@@ -532,7 +533,8 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
logit("Warning: This may be due to an old implementation of ssh.");
}
/* Get the host key. */
- host_key = key_new(KEY_RSA1);
+ if ((host_key = key_new(KEY_RSA1)) == NULL)
+ fatal("%s: key_new(KEY_RSA1) failed", __func__);
bits = packet_get_int();
packet_get_bignum(host_key->rsa->e);
packet_get_bignum(host_key->rsa->n);