Combined patch for the more or less obvious issues
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 21 Dec 2016 10:21:36 +0000 (11:21 +0100)
committerRich Salz <rsalz@openssl.org>
Mon, 6 Feb 2017 21:06:39 +0000 (16:06 -0500)
commit748cb9a17f4f2b77aad816cf658cd4025dc847ee
tree28ee694bfe96e0804bd1cf9fb1149a67d2ead2eb
parentefe8398649a1d7fc9d84d2818592652e0632a8a8
Combined patch for the more or less obvious issues

Fixed a memory leak in ASN1_digest and ASN1_item_digest.

asn1_template_noexp_d2i call ASN1_item_ex_free(&skfield,...) on error.

Reworked error handling in asn1_item_ex_combine_new:
- call ASN1_item_ex_free and return the correct error code if ASN1_template_new failed.
- dont call ASN1_item_ex_free if ASN1_OP_NEW_PRE failed.

Reworked error handing in x509_name_ex_d2i and x509_name_encode.

Fixed error handling in int_ctx_new and EVP_PKEY_CTX_dup.

Fixed a memory leak in def_get_class if lh_EX_CLASS_ITEM_insert fails due to OOM:
- to figure out if the insertion succeeded, use lh_EX_CLASS_ITEM_retrieve again.
- on error, p will be NULL, and gen needs to be cleaned up again.

int_free_ex_data needs to have a fallback solution if unable to allocate "storage":
- if free_func is non-zero this must be called to clean up all memory.

Fixed error handling in pkey_hmac_copy.

Fixed error handling in ssleay_rand_add and ssleay_rand_bytes.

Fixed error handling in X509_STORE_new.

Fixed a memory leak in ssl3_get_key_exchange.

Check for null pointer in ssl3_write_bytes.

Check for null pointer in ssl3_get_cert_verify.

Fixed a memory leak in ssl_cert_dup.

Fixes #2087 #2094 #2103 #2104 #2105 #2106 #2107 #2108 #2110 #2111 #2112 #2115

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2127)
13 files changed:
crypto/asn1/a_digest.c
crypto/asn1/tasn_dec.c
crypto/asn1/tasn_new.c
crypto/asn1/x_name.c
crypto/evp/pmeth_lib.c
crypto/ex_data.c
crypto/hmac/hm_pmeth.c
crypto/rand/md_rand.c
crypto/x509/x509_lu.c
ssl/s3_clnt.c
ssl/s3_pkt.c
ssl/s3_srvr.c
ssl/ssl_cert.c