mirror of
https://github.com/espressif/mbedtls.git
synced 2025-05-10 03:39:03 +08:00
Feedback from Arm: guarantee that output_length <= output_size even on error, to reduce the risk that a missing error check
escalates into a buffer overflow in the application code Signed-off-by: Stephan Koch <koch@oberon.ch> Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
8a23f49ebc
commit
6ed143635d
@ -4175,6 +4175,8 @@ void asymmetric_encrypt(int key_type_arg,
|
|||||||
TEST_EQUAL(actual_status, expected_status);
|
TEST_EQUAL(actual_status, expected_status);
|
||||||
if (actual_status == PSA_SUCCESS) {
|
if (actual_status == PSA_SUCCESS) {
|
||||||
TEST_EQUAL(output_length, expected_output_length);
|
TEST_EQUAL(output_length, expected_output_length);
|
||||||
|
} else {
|
||||||
|
TEST_LE_U(output_length, output_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the label is empty, the test framework puts a non-null pointer
|
/* If the label is empty, the test framework puts a non-null pointer
|
||||||
@ -4192,6 +4194,8 @@ void asymmetric_encrypt(int key_type_arg,
|
|||||||
TEST_EQUAL(actual_status, expected_status);
|
TEST_EQUAL(actual_status, expected_status);
|
||||||
if (actual_status == PSA_SUCCESS) {
|
if (actual_status == PSA_SUCCESS) {
|
||||||
TEST_EQUAL(output_length, expected_output_length);
|
TEST_EQUAL(output_length, expected_output_length);
|
||||||
|
} else {
|
||||||
|
TEST_LE_U(output_length, output_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user