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

Add checks for buffer size

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
This commit is contained in:
gabor-mezei-arm
2021-06-25 15:25:38 +02:00
parent 7fbea09847
commit 3fd792d076
2 changed files with 27 additions and 0 deletions

View File

@ -535,6 +535,12 @@ static psa_status_t cipher_decrypt( const psa_key_attributes_t *attributes,
if( status != PSA_SUCCESS )
goto exit;
if( output_size < accumulated_length )
{
status = PSA_ERROR_BUFFER_TOO_SMALL;
goto exit;
}
status = cipher_finish( &operation, output + accumulated_length,
output_size - accumulated_length, &olength );
accumulated_length += olength;