summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-12-25 18:49:57 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-12-25 18:49:57 +0000
commitac9bb7eda530dca8bd59bb900bbdfdb12e907586 (patch)
tree0f33147f7b2b1ee990878b8742b9acd91ff42375 /usr.bin
parentd143dc0732692875063f2384450dbedf6ba989f2 (diff)
be more careful on allocation
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/key.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/ssh/key.c b/usr.bin/ssh/key.c
index 1013578e1b0..3a0ed046bdf 100644
--- a/usr.bin/ssh/key.c
+++ b/usr.bin/ssh/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 <openssl/evp.h>
@@ -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: