Check that we were actually allocated BIGNUMs in dsa_builtin_paramgen2
authorMatt Caswell <matt@openssl.org>
Wed, 27 Apr 2016 12:32:58 +0000 (13:32 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 28 Apr 2016 12:13:09 +0000 (13:13 +0100)
Calls to BN_CTX_get() can fail so we should check that they were
successful.

Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/dsa/dsa_gen.c

index c278d9853de6d81731322c091a28d387ba9a3989..d97a06b4569c6dff14b6f1a62325181e48fb9468 100644 (file)
@@ -406,6 +406,8 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N,
     X = BN_CTX_get(ctx);
     c = BN_CTX_get(ctx);
     test = BN_CTX_get(ctx);
+    if (test == NULL)
+        goto err;
 
     /* if p, q already supplied generate g only */
     if (ret->p && ret->q) {