On Mon, Apr 03, 2023 at 09:30:23AM -0700, Tyler Retzlaff wrote:
> Replace use of variable length array optional standard feature to
> improve portability.
> 
> Signed-off-by: Tyler Retzlaff <roret...@linux.microsoft.com>
> ---
>  lib/telemetry/telemetry_json.h | 32 +++++++++++++++++++++++---------
>  1 file changed, 23 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h
> index 744bbfe..c375e97 100644
> --- a/lib/telemetry/telemetry_json.h
> +++ b/lib/telemetry/telemetry_json.h
> @@ -30,18 +30,23 @@
>  static inline int
>  __json_snprintf(char *buf, const int len, const char *format, ...)
>  {
> -     char tmp[len];
> +     char *tmp = malloc(len);
>       va_list ap;
> -     int ret;
> +     int ret = 0;
> +
> +     if (tmp == NULL)
> +             return ret;
>  
>       va_start(ap, format);
>       ret = vsnprintf(tmp, sizeof(tmp), format, ap);

I mistakenly pushed an old rev, i'll fix this.

sorry for the noise.

Reply via email to