Prevent NULL pointer dereference in x509_ocsp.c

Add a check at the beginning of the function
mbedtls_x509_ocsp_response_free() to ensure that the pointer passed to
is not NULL. This prevent a NULL pointer dereference that could lead to
crashes.
This commit is contained in:
Andres Amaya Garcia
2017-08-29 12:52:32 +01:00
committed by Andres Amaya Garcia
parent 3140f2fac5
commit 03b02e3277

View File

@@ -79,7 +79,9 @@ void mbedtls_x509_ocsp_response_free( mbedtls_x509_ocsp_response *resp )
{
mbedtls_x509_ocsp_single_response *cur, *next;
if( resp->resp_type.p == NULL )
if( resp == NULL )
return;
else if( resp->raw.p == NULL )
goto exit;
/* Free list of certificates */