diff options
author | Pauli <paul.dale@oracle.com> | 2018-06-29 09:55:23 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2018-06-29 13:21:06 +1000 |
commit | 8eab767a718f44ccba9888eeb81a5328cff47bab (patch) | |
tree | 43b16b20c3210370ff89d999884646c07cd8beb1 /ssl | |
parent | 10c3c1c1ec41ce16e51b92bb18fab92d1a42b49c (diff) | |
download | openssl-8eab767a718f44ccba9888eeb81a5328cff47bab.tar.gz |
Check return from BN_set_word.
In ssl/t1_lib.c.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6613)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/t1_lib.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 1826dd2bb3..abf523e49c 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -2309,13 +2309,16 @@ DH *ssl_get_auto_dh(SSL *s) if (dhp == NULL) return NULL; g = BN_new(); - if (g != NULL) - BN_set_word(g, 2); + if (g == NULL || !BN_set_word(g, 2)) { + DH_free(dhp); + BN_free(g); + return NULL; + } if (dh_secbits >= 192) p = BN_get_rfc3526_prime_8192(NULL); else p = BN_get_rfc3526_prime_3072(NULL); - if (p == NULL || g == NULL || !DH_set0_pqg(dhp, p, NULL, g)) { + if (p == NULL || !DH_set0_pqg(dhp, p, NULL, g)) { DH_free(dhp); BN_free(p); BN_free(g); |