[PATCH v3 5/5] telemetry: remove VLA in json string format function

Tyler Retzlaff roretzla at linux.microsoft.com
Fri Apr 7 21:54:15 CEST 2023


On Wed, Apr 05, 2023 at 05:03:26PM +0100, Bruce Richardson wrote:
> Since variable length arrays (VLAs) are potentially insecure and
> unsupported by some compilers, rework the code to remove their use. As
> with previous changes to remove VLAs in the telemetry code, this
> function uses two methods to avoid modifying the buffer when adding to
> it fails:
> * if there are only a few characters in the buffer, save them off to
>   restore on failure, then use the buffer as-is,
> * otherwise use malloc rather than a VLA to allocate a temporary buffer
>   and copy from that on success only.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> ---

Acked-by: Tyler Retzlaff <roretzla at linux.microsoft.com>



More information about the dev mailing list