Fix 1-byte buffer overflow in mbedtls_mpi_write_string()

This can only occur for negative numbers. Fixes #2404.
This commit is contained in:
Hanno Becker 2019-02-01 16:41:30 +00:00 committed by Janos Follath
parent cef29a2fd0
commit af97cae27d

View File

@ -602,7 +602,10 @@ int mbedtls_mpi_write_string( const mbedtls_mpi *X, int radix,
mbedtls_mpi_init( &T );
if( X->s == -1 )
{
*p++ = '-';
buflen--;
}
if( radix == 16 )
{