mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 00:15:40 +01:00
Fix buffer overflow in test mbedtls_mpi_is_prime_det
This commit is contained in:
parent
73497ceaef
commit
2521d16ace
@ -856,13 +856,13 @@ void mbedtls_mpi_is_prime_det( char *input_X, char *witnesses,
|
|||||||
mbedtls_mpi X;
|
mbedtls_mpi X;
|
||||||
int res;
|
int res;
|
||||||
mbedtls_test_mpi_random rand;
|
mbedtls_test_mpi_random rand;
|
||||||
uint8_t witness_buf[1000];
|
uint8_t *witness_buf = NULL;
|
||||||
uint8_t input_buf[1000];
|
uint8_t *input_buf = NULL;
|
||||||
size_t witness_len;
|
size_t witness_len;
|
||||||
size_t input_len;
|
size_t input_len;
|
||||||
|
|
||||||
witness_len = unhexify( witness_buf, witnesses );
|
witness_buf = unhexify_alloc( witnesses, &witness_len );
|
||||||
input_len = unhexify( input_buf, input_X );
|
input_buf = unhexify_alloc( input_X, &input_len );
|
||||||
|
|
||||||
mbedtls_mpi_init( &X );
|
mbedtls_mpi_init( &X );
|
||||||
rand.data = witness_buf;
|
rand.data = witness_buf;
|
||||||
@ -877,6 +877,8 @@ void mbedtls_mpi_is_prime_det( char *input_X, char *witnesses,
|
|||||||
|
|
||||||
exit:
|
exit:
|
||||||
mbedtls_mpi_free( &X );
|
mbedtls_mpi_free( &X );
|
||||||
|
mbedtls_free( witness_buf );
|
||||||
|
mbedtls_free( input_buf );
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user