From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 745688E7A for ; Fri, 11 Dec 2015 16:37:33 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 11 Dec 2015 07:37:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,414,1444719600"; d="scan'208";a="705536619" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga003.jf.intel.com with ESMTP; 11 Dec 2015 07:37:09 -0800 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.13]) by IRSMSX154.ger.corp.intel.com ([169.254.12.98]) with mapi id 14.03.0248.002; Fri, 11 Dec 2015 15:37:08 +0000 From: "Mcnamara, John" To: "Zhang, Roy Fan" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect Thread-Index: AQHRNAdDd5IP09bCQ0mAALPk0ukHd57F4otw Date: Fri, 11 Dec 2015 15:37:07 +0000 Message-ID: References: <1449833351-10011-1-git-send-email-roy.fan.zhang@intel.com> <1449833351-10011-2-git-send-email-roy.fan.zhang@intel.com> In-Reply-To: <1449833351-10011-2-git-send-email-roy.fan.zhang@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 15:37:33 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Fan Zhang > Sent: Friday, December 11, 2015 11:29 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size > buffer defect >=20 > Coverity issue: 107133 > Fixes: eb32fe7c5574 ("examples/ip_pipeline: rework initialization > parameters") >=20 > Signed-off-by: Fan Zhang > Acked-by: Cristian Dumitrescu > --- > examples/ip_pipeline/init.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c > index bc6d6d9..5bcb420 100644 > --- a/examples/ip_pipeline/init.c > +++ b/examples/ip_pipeline/init.c > @@ -1068,7 +1068,10 @@ static void app_pipeline_params_get(struct > app_params *app, > uint32_t i; > uint32_t mempool_id; >=20 > - strcpy(p_out->name, p_in->name); > + if (sizeof(p_in->name) > PIPELINE_NAME_SIZE) > + strncpy(p_out->name, p_in->name, PIPELINE_NAME_SIZE); > + else > + strcpy(p_out->name, p_in->name); >=20 > p_out->socket_id =3D (int) p_in->socket_id; >=20 Hi Fan, I think there could still be issues here (depending of the size/types of p_= out->name and p_in->name). Probably better as something like: strncpy(p_out->name, p_in->name, PIPELINE_NAME_SIZE); p_out->name[PIPELINE_NAME_SIZE -1] =3D '\0';=20 John. --=20