From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 8B7C2A00E6 for ; Mon, 15 Apr 2019 16:51:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A42911B1FE; Mon, 15 Apr 2019 16:51:00 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 85E5A1B1FD; Mon, 15 Apr 2019 16:50:58 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 07:50:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,354,1549958400"; d="scan'208";a="135972349" Received: from dhunt5-mobl2.ger.corp.intel.com (HELO [10.237.210.157]) ([10.237.210.157]) by orsmga006.jf.intel.com with ESMTP; 15 Apr 2019 07:50:56 -0700 To: Reshma Pattan , dev@dpdk.org Cc: stable@dpdk.org References: <20190409160024.40431-1-reshma.pattan@intel.com> From: "Hunt, David" Message-ID: Date: Mon, 15 Apr 2019 15:50:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190409160024.40431-1-reshma.pattan@intel.com> Content-Type: text/plain; charset="UTF-8"; format="flowed" Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH] examples/vm_power_manager: fix string null termination X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190415145055.GZ-i1bJW-60ey-HhlXsld20m--GfswBPPB2qNORSmRQ@z> On 9/4/2019 5:00 PM, Reshma Pattan wrote: > After the read() the jason_data null termination is missing > for the case "indent < 0", for "indent > 0" and "indent == 0" > cases null termination is already handled. > > So add the missing case "indent < 0" to the existing "indent == 0" > case to fix null termination. > > Coverity issue: 337680 > Fixes: a63504a90f ("examples/power: add JSON string handling") > CC: david.hunt@intel.com > CC: stable@dpdk.org > > Signed-off-by: Reshma Pattan > --- > examples/vm_power_manager/channel_monitor.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c > index 74df0fe20..c67ca4710 100644 > --- a/examples/vm_power_manager/channel_monitor.c > +++ b/examples/vm_power_manager/channel_monitor.c > @@ -807,7 +807,7 @@ read_json_packet(struct channel_info *chan_info) > indent--; > if ((indent > 0) || (idx > 0)) > idx++; > - if (indent == 0) > + if (indent <= 0) > json_data[idx] = 0; > if (idx >= MAX_JSON_STRING_LEN-1) > break; Acked-by: David Hunt