]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Fix PKCS#12 parsing of extra certificates with OpenSSL 1.0.1
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 16 Feb 2016 16:30:55 +0000 (18:30 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 16 Feb 2016 16:30:55 +0000 (18:30 +0200)
Commit 8bcf8de827e841a35841034edd6f8281a7a3aeba ('OpenSSL: Fix memory
leak in PKCS12 additional certificate parsing') tried to fix a memory
leak in both the 1.0.2(and newer) and 1.0.1 branches of PKCS12 parsing.
However, the 1.0.1 case was not properly tested and freeing of the
certificate after a successful SSL_CTX_add_extra_chain_cert() call
resulted in use of freed memory when going through the TLS handshake.
Fix this by not freeing the certificate in that specific case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/crypto/tls_openssl.c

index b23c219e81505a558700741388b44dfa2c00455f..ebcc54536c5a74d3da71e41197a40fec9b707dd4 100644 (file)
@@ -2538,7 +2538,6 @@ static int tls_parse_pkcs12(struct tls_data *data, SSL *ssl, PKCS12 *p12,
                                res = -1;
                                break;
                        }
-                       X509_free(cert);
                }
                sk_X509_pop_free(certs, X509_free);
 #endif /* OPENSSL_VERSION_NUMBER >= 0x10002000L */