DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] telemetry: fix JSON string formatter
@ 2023-05-25  7:20 David Marchand
  2023-05-25  8:30 ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2023-05-25  7:20 UTC (permalink / raw)
  To: dev; +Cc: thomas, Ciara Power, Tyler Retzlaff, Bruce Richardson

For large strings, we were incorrectly copying uninitialised data to the
output buffer.
Restore previous code.

Fixes: a515b7204e28 ("telemetry: remove VLA in JSON string formatter")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 lib/telemetry/telemetry_json.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h
index 7999535848..7a246deacb 100644
--- a/lib/telemetry/telemetry_json.h
+++ b/lib/telemetry/telemetry_json.h
@@ -153,7 +153,7 @@ __json_format_str(char *buf, const int len, const char *prefix, const char *str,
 
 	ret = __json_format_str_to_buf(tmp, len, prefix, str, suffix);
 	if (ret > 0)
-		strcpy(buf, saved);
+		strcpy(buf, tmp);
 
 	free(tmp);
 	return ret;
-- 
2.40.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-25  8:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25  7:20 [PATCH] telemetry: fix JSON string formatter David Marchand
2023-05-25  8:30 ` Bruce Richardson
2023-05-25  8:38   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).