From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2EC99428E8; Fri, 7 Apr 2023 21:54:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3F4940E0F; Fri, 7 Apr 2023 21:54:17 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 24EE940E03 for ; Fri, 7 Apr 2023 21:54:16 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 381FD21345FF; Fri, 7 Apr 2023 12:54:15 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 381FD21345FF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1680897255; bh=AKfcGN0vtTWU5Z04XsZSLbFcgr1VVz5UA9MGwyatIGo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ro5Jtl50/PjSiHQTsO196o+2Sr6QIQrYVmM4eQVhGzcgUdEBRxUtJCLfRzmGvwqpP 6GWnIfS9k4KYwEISs19fSFF7pPoiSR/SO44U3rtCFwykNeLsWqslo2jhLfToKl9nrN FUF0Cl3c3gfkYh+5bfMizYQ97UTJDkuCKb/Fj3L8= Date: Fri, 7 Apr 2023 12:54:15 -0700 From: Tyler Retzlaff To: Bruce Richardson Cc: dev@dpdk.org, ciara.power@intel.com Subject: Re: [PATCH v3 5/5] telemetry: remove VLA in json string format function Message-ID: <20230407195415.GF3014@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <20230310181836.162336-1-bruce.richardson@intel.com> <20230405160326.186921-1-bruce.richardson@intel.com> <20230405160326.186921-6-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230405160326.186921-6-bruce.richardson@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Wed, Apr 05, 2023 at 05:03:26PM +0100, Bruce Richardson wrote: > Since variable length arrays (VLAs) are potentially insecure and > unsupported by some compilers, rework the code to remove their use. As > with previous changes to remove VLAs in the telemetry code, this > function uses two methods to avoid modifying the buffer when adding to > it fails: > * if there are only a few characters in the buffer, save them off to > restore on failure, then use the buffer as-is, > * otherwise use malloc rather than a VLA to allocate a temporary buffer > and copy from that on success only. > > Signed-off-by: Bruce Richardson > --- Acked-by: Tyler Retzlaff