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:18:48 +0000 (12:18 +0000)
commitabcf241114c4dc33af95288ae7f7d10916c67db0
tree8fddfe70dc56c32dc80e2315be13daf79eb0a85e
parent8db7946ee879ce483f4c81141926e1357aa6b941
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