From: Gowrishankar Muthukrishnan Date: Mon, 11 Oct 2021 10:54:43 +0000 (+0530) Subject: telemetry: fix JSON output buffer length X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b76731683b048337d853cca4fa1530218b82aa40;p=dpdk.git telemetry: fix JSON output buffer length Earlier, JSON message length was limited to 1024 which would not allow data more than this size. Removed this limitation by creating output buffer based on requested data length. Fixes: 52af6ccb2b39 ("telemetry: add utility functions for creating JSON") Cc: stable@dpdk.org Signed-off-by: Gowrishankar Muthukrishnan Acked-by: Ciara Power --- diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h index ad270b9b30..f02a12f5b0 100644 --- a/lib/telemetry/telemetry_json.h +++ b/lib/telemetry/telemetry_json.h @@ -9,6 +9,7 @@ #include #include #include +#include /** * @file @@ -23,13 +24,13 @@ * @internal * Copies a value into a buffer if the buffer has enough available space. * Nothing written to buffer if an overflow ocurs. - * This function is not for use for values larger than 1k. + * This function is not for use for values larger than given buffer length. */ __rte_format_printf(3, 4) static inline int __json_snprintf(char *buf, const int len, const char *format, ...) { - char tmp[1024]; + char tmp[len]; va_list ap; int ret;