X509V3_EXT_add_nconf_sk, X509v3_add_ext: fix errors handling
authorPavel Kopyl <p.kopyl@samsung.com>
Tue, 7 Nov 2017 12:28:18 +0000 (15:28 +0300)
committerMatt Caswell <matt@openssl.org>
Wed, 21 Feb 2018 12:22:56 +0000 (12:22 +0000)
commit2d4def005263614d23b9dcbf98f48c145ea1b0cf
tree6473f14239c7354df2c1d2855a9bc48a16326b2f
parent5a19f9ea7a27453d67c09160a8c806e644e844e7
X509V3_EXT_add_nconf_sk, X509v3_add_ext: fix errors handling

X509v3_add_ext: free 'sk' if the memory pointed to by it
was malloc-ed inside this function.
X509V3_EXT_add_nconf_sk: return an error if X509v3_add_ext() fails.
This prevents use of a freed memory in do_body:sk_X509_EXTENSION_num().

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4698)
crypto/x509/x509_v3.c
crypto/x509v3/v3_conf.c