Peter Maydell f8324611c1 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>
2023-08-31 19:47:43 +02:00
..
2023-08-31 19:47:43 +02:00
2022-01-13 10:22:37 +01:00
2022-01-13 10:22:37 +01:00
2022-11-08 11:13:48 +01:00
2022-10-31 20:37:58 +00:00
2022-11-08 11:13:48 +01:00
2022-11-08 11:13:48 +01:00
2023-08-31 19:47:43 +02:00
2022-11-08 11:13:48 +01:00
2023-08-31 19:47:43 +02:00
2023-08-31 19:47:43 +02:00
2023-08-31 19:47:43 +02:00
2023-08-31 19:47:43 +02:00
2023-08-31 19:47:43 +02:00