qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] tests/qtest/xlnx-versal-trng-test.c: Drop use of variabl


From: Thomas Huth
Subject: Re: [PATCH 1/2] tests/qtest/xlnx-versal-trng-test.c: Drop use of variable length array
Date: Thu, 25 Jan 2024 19:59:16 +0100
User-agent: Mozilla Thunderbird

On 25/01/2024 18.32, Peter Maydell wrote:
This test program is the last use of any variable length array in the
codebase.  If we can get rid of all uses of VLAs we can make the
compiler error on new additions.  This is a defensive measure against
security bugs where an on-stack dynamic allocation isn't correctly
size-checked (e.g.  CVE-2021-3527).

In this case the test code didn't even want a variable-sized
array, it was just accidentally using syntax that gave it one.
(The array size for C has to be an actual constant expression,
not just something that happens to be known to be constant...)

Remove the VLA usage.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
  tests/qtest/xlnx-versal-trng-test.c | 19 +++++++++++--------
  1 file changed, 11 insertions(+), 8 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]