1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-07 06:42:56 +03:00

- Fixed incorrect handling of negative strings in mpi_read_string() (found by code coverage tests).

This commit is contained in:
Paul Bakker
2009-06-20 08:22:43 +00:00
parent 80ab9f5eb5
commit 05feca6f7c
2 changed files with 14 additions and 1 deletions

View File

@@ -286,7 +286,15 @@ int mpi_read_string( mpi *X, int radix, char *s )
MPI_CHK( mpi_get_digit( &d, radix, s[i] ) );
MPI_CHK( mpi_mul_int( &T, X, radix ) );
MPI_CHK( mpi_add_int( X, &T, d ) );
if( X->s == 1 )
{
MPI_CHK( mpi_add_int( X, &T, d ) );
}
else
{
MPI_CHK( mpi_sub_int( X, &T, d ) );
}
}
}