mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Fix null pointer dereference in mpi_mod_int(0, 2)
Fix a null pointer dereference when performing some operations on zero represented with 0 limbs: mbedtls_mpi_mod_int() dividing by 2, or mbedtls_mpi_write_string() in base 2. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
@ -1829,7 +1829,7 @@ int mbedtls_mpi_mod_int( mbedtls_mpi_uint *r, const mbedtls_mpi *A, mbedtls_mpi_
|
||||
/*
|
||||
* handle trivial cases
|
||||
*/
|
||||
if( b == 1 )
|
||||
if( b == 1 || A->n == 0 )
|
||||
{
|
||||
*r = 0;
|
||||
return( 0 );
|
||||
|
Reference in New Issue
Block a user