diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2023-08-24 17:48:18 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2023-08-31 19:47:43 +0200 |
commit | f8324611c1ec100fd601842d3943cbf8acd1420f (patch) | |
tree | d4904a110956b8516b51ed84e741bf0a5e58c28b /hw/virtio/vhost-user-gpio.c | |
parent | 2a8537cfbcf3d0a14e88c5bb42a43a6c8ed5955e (diff) | |
download | qemu-f8324611c1ec100fd601842d3943cbf8acd1420f.zip qemu-f8324611c1ec100fd601842d3943cbf8acd1420f.tar.gz qemu-f8324611c1ec100fd601842d3943cbf8acd1420f.tar.bz2 |
hw/usb/hcd-xhci: Avoid variable-length array in xhci_get_port_bandwidth()
In xhci_get_port_bandwidth(), we use a variable-length array to
construct the buffer to send back to the guest. Avoid the VLA
by using dma_memory_set() to directly request the memory system
to fill the guest memory with a string of '80's.
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: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20230824164818.2652452-1-peter.maydell@linaro.org>
Diffstat (limited to 'hw/virtio/vhost-user-gpio.c')
0 files changed, 0 insertions, 0 deletions