mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-08 10:09:54 +00:00
Fix other occurrences of same bounds check issue
Security impact is the same: not triggerrable remotely except in very specific
use cases
backport of 4dc9b39
This commit is contained in:
parent
758f490c90
commit
8abc22dde5
|
@ -97,7 +97,7 @@ static int pk_write_ec_pubkey( unsigned char **p, unsigned char *start,
|
|||
return( ret );
|
||||
}
|
||||
|
||||
if( *p - start < (int) len )
|
||||
if( *p < start || (size_t)( *p - start ) < len )
|
||||
return( POLARSSL_ERR_ASN1_BUF_TOO_SMALL );
|
||||
|
||||
*p -= len;
|
||||
|
|
|
@ -265,13 +265,16 @@ int x509_write_sig( unsigned char **p, unsigned char *start,
|
|||
int ret;
|
||||
size_t len = 0;
|
||||
|
||||
if( *p - start < (int) size + 1 )
|
||||
if( *p < start || (size_t)( *p - start ) < size )
|
||||
return( POLARSSL_ERR_ASN1_BUF_TOO_SMALL );
|
||||
|
||||
len = size;
|
||||
(*p) -= len;
|
||||
memcpy( *p, sig, len );
|
||||
|
||||
if( *p - start < 1 )
|
||||
return( POLARSSL_ERR_ASN1_BUF_TOO_SMALL );
|
||||
|
||||
*--(*p) = 0;
|
||||
len += 1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue