]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 4918: Crashes when using OpenSSL prior to v1.0.2 (#465)
authorEneas U de Queiroz <cotequeiroz@gmail.com>
Wed, 21 Aug 2019 18:01:24 +0000 (18:01 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 23 Aug 2019 18:03:06 +0000 (18:03 +0000)
commit158a2ae3cf30922b90f3e0345afd121161a4a658
tree1dffa27828204d607df3b43f3beacc46a170fc9d
parent5562295321debdf33b59f772bce846bf6dd33c26
Bug 4918: Crashes when using OpenSSL prior to v1.0.2 (#465)

The implementation of x509_get0_signature() replacement in 24b30fd was
based on OpenSSL v1.1.0 where `signature` and `sig_alg` members of
`x509_st` structure stopped being raw pointers and became structures.
The mismatch caused segfaults when using OpenSSL versions that lacked
x509_get0_signature() -- anything earlier than OpenSSL v1.0.2.

    // OpenSSL < v1.1.0
    struct x509_st {
        X509_CINF *cert_info;
        X509_ALGOR *sig_alg;
        ASN1_BIT_STRING *signature;
        ...
    }

    // OpenSSL >= v1.1.0
    struct x509_st {
        X509_CINF cert_info;
        X509_ALGOR sig_alg;
        ASN1_BIT_STRING signature;
        ...
    }

A C-style reinterpreting cast hid the type mismatch from the compilers
and reviewers.

Tested with OpenSSL v1.0.1f. The types of the two data members were
checked back to OpenSSL v0.9.6.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
compat/openssl.h