mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-06-20 18:48:01 +00:00
Fix potential overflow in CertificateRequest
This commit is contained in:
parent
c7e61a2e3f
commit
de9c8a5734
|
@ -21,6 +21,10 @@ Security
|
||||||
* Fix possible heap buffer overflow in base64_encode() when the input
|
* Fix possible heap buffer overflow in base64_encode() when the input
|
||||||
buffer is 512MB or larger on 32-bit platforms.
|
buffer is 512MB or larger on 32-bit platforms.
|
||||||
Found by Guido Vranken. Not trigerrable remotely in TLS.
|
Found by Guido Vranken. Not trigerrable remotely in TLS.
|
||||||
|
* Fix potential heap buffer overflow in servers that perform client
|
||||||
|
authentication against a crafted CA cert. Cannot be triggered remotely
|
||||||
|
unless you allow third parties to pick trust CAs for client auth.
|
||||||
|
Found by Guido Vranken.
|
||||||
|
|
||||||
= mbed TLS 1.3.13 released 2015-09-17
|
= mbed TLS 1.3.13 released 2015-09-17
|
||||||
|
|
||||||
|
|
|
@ -2300,6 +2300,7 @@ static int ssl_write_certificate_request( ssl_context *ssl )
|
||||||
size_t ct_len, sa_len; /* including length bytes */
|
size_t ct_len, sa_len; /* including length bytes */
|
||||||
unsigned char *buf, *p;
|
unsigned char *buf, *p;
|
||||||
const x509_crt *crt;
|
const x509_crt *crt;
|
||||||
|
const unsigned char * const end = ssl->out_msg + SSL_MAX_CONTENT_LEN;
|
||||||
|
|
||||||
SSL_DEBUG_MSG( 2, ( "=> write certificate request" ) );
|
SSL_DEBUG_MSG( 2, ( "=> write certificate request" ) );
|
||||||
|
|
||||||
|
@ -2406,10 +2407,14 @@ static int ssl_write_certificate_request( ssl_context *ssl )
|
||||||
total_dn_size = 0;
|
total_dn_size = 0;
|
||||||
while( crt != NULL && crt->version != 0 )
|
while( crt != NULL && crt->version != 0 )
|
||||||
{
|
{
|
||||||
if( p - buf > 4096 )
|
|
||||||
break;
|
|
||||||
|
|
||||||
dn_size = crt->subject_raw.len;
|
dn_size = crt->subject_raw.len;
|
||||||
|
|
||||||
|
if( end < p || (size_t)( end - p ) < 2 + dn_size )
|
||||||
|
{
|
||||||
|
SSL_DEBUG_MSG( 1, ( "skipping CAs: buffer too short" ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
*p++ = (unsigned char)( dn_size >> 8 );
|
*p++ = (unsigned char)( dn_size >> 8 );
|
||||||
*p++ = (unsigned char)( dn_size );
|
*p++ = (unsigned char)( dn_size );
|
||||||
memcpy( p, crt->subject_raw.p, dn_size );
|
memcpy( p, crt->subject_raw.p, dn_size );
|
||||||
|
|
Loading…
Reference in a new issue