summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm <djm>2002-01-22 12:07:21 +0000
committerdjm <djm>2002-01-22 12:07:21 +0000
commitfa42f0b5faae3b2a0d3caab0ac47f7dd20b564b0 (patch)
treea92dc3f748575719e5a7b93483e5ba8f78de9aa5
parent4e39812096aa3c7301aaf99527a480ec79322fb4 (diff)
downloadopenssh-fa42f0b5faae3b2a0d3caab0ac47f7dd20b564b0.tar.gz
- markus@cvs.openbsd.org 2001/12/25 18:49:56
[key.c] be more careful on allocation
-rw-r--r--ChangeLog5
-rw-r--r--key.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f874fc54..beccb529 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,9 @@
- deraadt@cvs.openbsd.org 2001/12/24 07:29:43
[ssh-add.c]
try all listed keys.. how did this get broken?
+ - markus@cvs.openbsd.org 2001/12/25 18:49:56
+ [key.c]
+ be more careful on allocation
20020121
- (djm) Rework ssh-rand-helper:
@@ -7173,4 +7176,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.1729 2002/01/22 12:07:01 djm Exp $
+$Id: ChangeLog,v 1.1730 2002/01/22 12:07:21 djm Exp $
diff --git a/key.c b/key.c
index 1013578e..3a0ed046 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 <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: