X509V3_EXT_add_nconf_sk, X509v3_add_ext: fix errors handling
authorPavel Kopyl <p.kopyl@samsung.com>
Sun, 10 Dec 2017 19:49:42 +0000 (22:49 +0300)
committerMatt Caswell <matt@openssl.org>
Wed, 21 Feb 2018 12:28:56 +0000 (12:28 +0000)
commitbecdc13fd87052058c87dd0ee3894345617085b8
treebe139923ef8754414485303b1e35c68142b2368c
parentcb7503750efc02c64cdb7167dee692e47c44c6e9
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: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4896)
crypto/x509/x509_v3.c
crypto/x509v3/v3_conf.c