From patchwork Thu May 25 07:20:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 127369 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1D18042B95; Thu, 25 May 2023 09:20:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5A0740DDB; Thu, 25 May 2023 09:20:45 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 0FC6D40A82 for ; Thu, 25 May 2023 09:20:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684999243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C94UNWK8GlTTh/Bu98K7Fpr2yPd9JN7euebsYDQRs68=; b=Ec6QJ2RXl7546W87edp5qF/NfIHaLlYWQV56U6tgBzw1xT8KPUKPt5TBUy6E7UeM+uSlJb GnNLSro4a0iG7rR+otzn7KuMjD+f2lxwCi2s+4LFXS2BgAbrBywz0pjZu8MQ1zn6SX2zbP +G3gJYRLvEBfyoEaarzQBq8Qc9PY8gE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-118-49FobCrmOD-QTB3BMO7IJQ-1; Thu, 25 May 2023 03:20:40 -0400 X-MC-Unique: 49FobCrmOD-QTB3BMO7IJQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9EDBF85A5BA; Thu, 25 May 2023 07:20:39 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BDF52166B2B; Thu, 25 May 2023 07:20:38 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, Ciara Power , Tyler Retzlaff , Bruce Richardson Subject: [PATCH] telemetry: fix JSON string formatter Date: Thu, 25 May 2023 09:20:35 +0200 Message-Id: <20230525072035.2512566-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Acked-by: Bruce Richardson --- 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;