Fix other occurrences of same bounds check issue

Security impact is the same: not triggerrable remotely except in very specific
use cases
This commit is contained in:
Manuel Pégourié-Gonnard 2015-10-21 12:23:09 +02:00
parent 22c3b7b9da
commit 4dc9b394d3
2 changed files with 5 additions and 2 deletions

View file

@ -96,7 +96,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( MBEDTLS_ERR_ASN1_BUF_TOO_SMALL );
*p -= len;