From 503761ac45c1546f211c3585f58f352f16400891 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 22 Jan 2002 23:07:21 +1100 Subject: - markus@cvs.openbsd.org 2001/12/25 18:49:56 [key.c] be more careful on allocation --- key.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'key.c') diff --git a/key.c b/key.c index 1013578e1..3a0ed046b 100644 --- a/key.c +++ b/key.c @@ -32,7 +32,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "includes.h" -RCSID("$OpenBSD: key.c,v 1.36 2001/12/19 07:18:56 deraadt Exp $"); +RCSID("$OpenBSD: key.c,v 1.37 2001/12/25 18:49:56 markus Exp $"); #include @@ -63,6 +63,8 @@ key_new(int type) rsa = RSA_new(); rsa->n = BN_new(); rsa->e = BN_new(); + if (rsa == NULL || rsa->n == NULL || rsa->e == NULL) + fatal("key_new: malloc failure"); k->rsa = rsa; break; case KEY_DSA: @@ -71,6 +73,9 @@ key_new(int type) dsa->q = BN_new(); dsa->g = BN_new(); dsa->pub_key = BN_new(); + if (dsa == NULL || dsa->p == NULL || dsa->q == NULL || + dsa->g == NULL || dsa->pub_key == NULL) + fatal("key_new: malloc failure"); k->dsa = dsa; break; case KEY_UNSPEC: -- cgit v1.2.3