Skip to content

Commit cd6fb18

Browse files
Validate output length in the child
If the child reports an output length that's larger than the buffer, report it rather than overread the buffer. The parent would catch the excess length anyway, but having the child catch it makes the behavior more uniform with respect to the presence or absence of sanitizers. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
1 parent e713bae commit cd6fb18

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tests/src/fork_helpers.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ static void run_child(
8080

8181
child_callback(param, buf, size, &length);
8282

83+
TEST_LE_U(length, size);
84+
8385
if (mbedtls_test_get_result() == MBEDTLS_TEST_RESULT_SUCCESS && length != 0) {
8486
/* Write the output. This could fail on a full disk. Remember to
8587
* flush (otherwise the output would likely be truncated). */

0 commit comments

Comments
 (0)