diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2017-03-20 20:50:23 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-03-29 07:42:00 +0200 |
commit | 62f488d31733e5dc77b339f905b44f165550e47d (patch) | |
tree | 9f385987b76198fad8afb8aaae4f1e676dcfee7f /crypto/ex_data.c | |
parent | 144ab9b27ffec3f4f01a4a2c069309323bf886d9 (diff) |
Fix the error handling in CRYPTO_dup_ex_data.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2998)
Diffstat (limited to 'crypto/ex_data.c')
-rw-r--r-- | crypto/ex_data.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/ex_data.c b/crypto/ex_data.c index d947f3edac..108a1959ea 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -459,7 +459,7 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from) { int mx, j, i; - char *ptr; + void *ptr; CRYPTO_EX_DATA_FUNCS **storage = NULL; EX_CLASS_ITEM *item; if (!from->sk) @@ -473,6 +473,8 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, if (j < mx) mx = j; if (mx > 0) { + if (!CRYPTO_set_ex_data(to, mx - 1, NULL)) + goto skip; storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS *)); if (!storage) goto skip; |