DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, Ciara Power <ciara.power@intel.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH] telemetry: fix JSON string formatter
Date: Thu, 25 May 2023 09:20:35 +0200	[thread overview]
Message-ID: <20230525072035.2512566-1-david.marchand@redhat.com> (raw)

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


             reply	other threads:[~2023-05-25  7:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25  7:20 David Marchand [this message]
2023-05-25  8:30 ` Bruce Richardson
2023-05-25  8:38   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230525072035.2512566-1-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=roretzla@linux.microsoft.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).