1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-30 22:43:08 +03:00

Rework mbedtls_test_unhexify()

Rework mbedtls_test_unhexify to extend its scope of usage.
Return in error when the function detects an error instead
of calling mbedtls_exit().
Improve safety by checking the output buffer is not overrun.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron
2020-06-18 10:10:46 +02:00
parent 9ed4073ea5
commit a0c2539c4c
4 changed files with 79 additions and 32 deletions

View File

@ -277,8 +277,13 @@ static int convert_params( size_t cnt , char ** params , int * int_params_store
{
if ( verify_string( &val ) == 0 )
{
*int_params_store = mbedtls_test_unhexify(
(unsigned char *) val, val );
size_t len;
TEST_HELPER_ASSERT(
mbedtls_test_unhexify( (unsigned char *) val, strlen( val ),
val, &len ) == 0 );
*int_params_store = len;
*out++ = val;
*out++ = (char *)(int_params_store++);
}