mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 08:05:37 +01:00
Merge remote-tracking branch 'public/pr/1774' into mbedtls-2.1
This commit is contained in:
commit
258b3f6113
@ -1,5 +1,11 @@
|
|||||||
mbed TLS ChangeLog (Sorted per branch, date)
|
mbed TLS ChangeLog (Sorted per branch, date)
|
||||||
|
|
||||||
|
= mbed TLS x.x.x branch released xxxx-xx-xx
|
||||||
|
|
||||||
|
Bugfix
|
||||||
|
* Fix a memory leak in mbedtls_x509_csr_parse(), found by catenacyber,
|
||||||
|
Philippe Antoine.
|
||||||
|
|
||||||
= mbed TLS 2.1.13 branch released 2018-06-18
|
= mbed TLS 2.1.13 branch released 2018-06-18
|
||||||
|
|
||||||
Bugfix
|
Bugfix
|
||||||
|
@ -272,34 +272,25 @@ int mbedtls_x509_csr_parse( mbedtls_x509_csr *csr, const unsigned char *buf, siz
|
|||||||
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
|
return( MBEDTLS_ERR_X509_BAD_INPUT_DATA );
|
||||||
|
|
||||||
#if defined(MBEDTLS_PEM_PARSE_C)
|
#if defined(MBEDTLS_PEM_PARSE_C)
|
||||||
mbedtls_pem_init( &pem );
|
|
||||||
|
|
||||||
/* Avoid calling mbedtls_pem_read_buffer() on non-null-terminated string */
|
/* Avoid calling mbedtls_pem_read_buffer() on non-null-terminated string */
|
||||||
if( buflen == 0 || buf[buflen - 1] != '\0' )
|
if( buf[buflen - 1] == '\0' )
|
||||||
ret = MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT;
|
{
|
||||||
else
|
mbedtls_pem_init( &pem );
|
||||||
ret = mbedtls_pem_read_buffer( &pem,
|
ret = mbedtls_pem_read_buffer( &pem,
|
||||||
"-----BEGIN CERTIFICATE REQUEST-----",
|
"-----BEGIN CERTIFICATE REQUEST-----",
|
||||||
"-----END CERTIFICATE REQUEST-----",
|
"-----END CERTIFICATE REQUEST-----",
|
||||||
buf, NULL, 0, &use_len );
|
buf, NULL, 0, &use_len );
|
||||||
|
|
||||||
if( ret == 0 )
|
if( ret == 0 )
|
||||||
{
|
/*
|
||||||
/*
|
* Was PEM encoded, parse the result
|
||||||
* Was PEM encoded, parse the result
|
*/
|
||||||
*/
|
ret = mbedtls_x509_csr_parse_der( csr, pem.buf, pem.buflen );
|
||||||
if( ( ret = mbedtls_x509_csr_parse_der( csr, pem.buf, pem.buflen ) ) != 0 )
|
|
||||||
return( ret );
|
|
||||||
|
|
||||||
mbedtls_pem_free( &pem );
|
mbedtls_pem_free( &pem );
|
||||||
return( 0 );
|
if( ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT )
|
||||||
|
return( ret );
|
||||||
}
|
}
|
||||||
else if( ret != MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT )
|
|
||||||
{
|
|
||||||
mbedtls_pem_free( &pem );
|
|
||||||
return( ret );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif /* MBEDTLS_PEM_PARSE_C */
|
#endif /* MBEDTLS_PEM_PARSE_C */
|
||||||
return( mbedtls_x509_csr_parse_der( csr, buf, buflen ) );
|
return( mbedtls_x509_csr_parse_der( csr, buf, buflen ) );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user