aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/qapi/source.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-08-24 16:32:21 +0100
committerJason Wang <jasowang@redhat.com>2023-09-18 14:36:13 +0800
commit2a6cb383e2ec7224d8631c3c0a324bff469c9c64 (patch)
tree59136aca4b3b7e33553e4c5aadb38b278d252adc /scripts/qapi/source.py
parentnet: add initial support for AF_XDP network backend (diff)
downloadqemu-2a6cb383e2ec7224d8631c3c0a324bff469c9c64.tar.xz
qemu-2a6cb383e2ec7224d8631c3c0a324bff469c9c64.zip
hw/net/fsl_etsec/rings.c: Avoid variable length array
In fill_rx_bd() we create a variable length array of size etsec->rx_padding. In fact we know that this will never be larger than 64 bytes, because rx_padding is set in rx_init_frame() in a way that ensures it is only that large. Use a fixed sized array and assert that it is big enough. Since padd[] is now potentially rather larger than the actual padding required, adjust the memset() we do on it to match the size that we write with cpu_physical_memory_write(), rather than clearing the entire array. The codebase has very few VLAs, and if we can get rid of them all 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). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'scripts/qapi/source.py')
0 files changed, 0 insertions, 0 deletions