New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory leak in X509 certificate validation #237
Labels
Milestone
Comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I get following Valgrind output from an application utilizing libmosquitto:
==9472== 265 (32 direct, 233 indirect) bytes in 1 blocks are definitely lost in loss record 588 of 638
==9472== at 0x4C2BBCF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9472== by 0x5103E77: CRYPTO_malloc (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
==9472== by 0x51BA7AE: sk_new (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
==9472== by 0x51E2402: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
==9472== by 0x51E255B: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
==9472== by 0x51E1736: ASN1_item_ex_d2i (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
==9472== by 0x51E206A: ASN1_item_d2i (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
==9472== by 0x5200703: X509V3_EXT_d2i (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
==9472== by 0x45CDB6: _mosquitto_verify_certificate_hostname (in /tmp/build/DCe.x86_64-generic-linux.Debug/sample)
==9472== by 0x45CC59: _mosquitto_server_certificate_verify (in /tmp/build/DCe.x86_64-generic-linux.Debug/sample)
==9472== by 0x51F5BC4: ??? (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
==9472== by 0x51F77C1: X509_verify_cert (in /lib/x86_64-linux-gnu/libcrypto.so.1.0.0)
It seems that in
lib/tls_mosq.c
int _mosquitto_verify_certificate_hostname(X509 *cert, const char *hostname)
san = X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL);
allocates memory tosan
that is never freed.The text was updated successfully, but these errors were encountered: