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 F2C5CA0096 for ; Tue, 9 Apr 2019 18:00:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 905EF2BCE; Tue, 9 Apr 2019 18:00:31 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 0EA3D2BCE; Tue, 9 Apr 2019 18:00:29 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Apr 2019 09:00:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,329,1549958400"; d="scan'208";a="129896031" Received: from silpixa00400214.ir.intel.com (HELO silpixa00400214.ger.corp.intel.com) ([10.237.223.195]) by orsmga007.jf.intel.com with ESMTP; 09 Apr 2019 09:00:26 -0700 From: Reshma Pattan To: dev@dpdk.org Cc: Reshma Pattan , david.hunt@intel.com, stable@dpdk.org Date: Tue, 9 Apr 2019 17:00:24 +0100 Message-Id: <20190409160024.40431-1-reshma.pattan@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH] examples/vm_power_manager: fix string null termination X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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; -- 2.17.1