ui/vnc-enc-tight: Avoid dynamic stack allocation
commitdd0439e1496ad326dcaa7dc67f91f2e6f6c4930b
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Fri, 18 Aug 2023 15:10:57 +0000 (18 16:10 +0100)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 4 Sep 2023 10:57:44 +0000 (4 14:57 +0400)
treed3b744bf7d67795e31eaf0f31f16ff09b1142812
parente12acaf75d1ffadfd527180dac798368716a0001
ui/vnc-enc-tight: Avoid dynamic stack allocation

Use autofree heap allocation instead of variable-length
array on the stack.

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: Philippe Mathieu-Daudé <philmd@redhat.com>
[PMM: expanded commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230818151057.1541189-4-peter.maydell@linaro.org>
ui/vnc-enc-tight.c