diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2018-05-03 14:22:49 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2018-05-04 12:57:46 +0000 |
commit | 28071ad25333e3c44245e45b483eb9e5818b077a (patch) | |
tree | aaa72fb86686e5015c58cac080bbe610bce76405 /src | |
parent | 93e0ff037e3e4d72d404c26b8e957092d5f88652 (diff) |
Fix crash in qsslsocket_openssl
We were using the wrong free function in a path which was hit in an
edge case (PKCS#12 certificate without a private key attached).
Change-Id: I5335b5dea7a926b242bed0fd9b989b681a5828d8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 1fc7817fe8..cecb4fb753 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1517,7 +1517,7 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device, if (!key->d->fromEVP_PKEY(pkey)) { qCWarning(lcSsl, "Unable to convert private key"); q_OPENSSL_sk_pop_free(reinterpret_cast<OPENSSL_STACK *>(ca), - reinterpret_cast<void (*)(void *)>(q_OPENSSL_sk_free)); + reinterpret_cast<void (*)(void *)>(q_X509_free)); q_X509_free(x509); q_EVP_PKEY_free(pkey); q_PKCS12_free(p12); @@ -1532,8 +1532,6 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device, *caCertificates = QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates(ca); // Clean up - // TODO: verify ASAP, in the past we had sk_pop_free with q_OPENSSL_sk_free - // which seems to be blatantly wrong and even crashes with 1.1. q_OPENSSL_sk_pop_free(reinterpret_cast<OPENSSL_STACK *>(ca), reinterpret_cast<void (*)(void *)>(q_X509_free)); |