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 0ACABA00E6 for ; Mon, 15 Apr 2019 16:45:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0F1001B20D; Mon, 15 Apr 2019 16:45:19 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E4D271B205; Mon, 15 Apr 2019 16:45:15 +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:45:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,354,1549958400"; d="scan'208";a="135971164" 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:45:13 -0700 To: Reshma Pattan , dev@dpdk.org Cc: stable@dpdk.org References: <20190410145431.35269-1-reshma.pattan@intel.com> From: "Hunt, David" Message-ID: Date: Mon, 15 Apr 2019 15:45:12 +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: <20190410145431.35269-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 overflow 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: <20190415144512.w6hxp8MV-8hJvtKYFS9PvzlrcToZvaVZMsIFx1dkN6E@z> On 10/4/2019 3:54 PM, Reshma Pattan wrote: > Use strlcpy instead of strcpy to fix string overflow. > > Coverity issue: 337671 > 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 | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c > index 74df0fe20..0b44a74b5 100644 > --- a/examples/vm_power_manager/channel_monitor.c > +++ b/examples/vm_power_manager/channel_monitor.c > @@ -159,7 +159,8 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt) > if (ret) > return ret; > } else if (!strcmp(key, "name")) { > - strcpy(pkt->vm_name, json_string_value(value)); > + strlcpy(pkt->vm_name, json_string_value(value), > + sizeof(pkt->vm_name)); > } else if (!strcmp(key, "command")) { > char command[32]; > strlcpy(command, json_string_value(value), 32); Acked-by: David Hunt