From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id A9FE8AA92 for ; Tue, 8 May 2018 16:29:34 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2018 07:29:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,378,1520924400"; d="scan'208";a="44163737" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by fmsmga002.fm.intel.com with ESMTP; 08 May 2018 07:29:32 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.150]) by IRSMSX151.ger.corp.intel.com ([169.254.4.167]) with mapi id 14.03.0319.002; Tue, 8 May 2018 15:29:32 +0100 From: "Dumitrescu, Cristian" To: "Singh, Jasvinder" , "dev@dpdk.org" CC: "Richardson, Bruce" Thread-Topic: [PATCH v2] examples/ip_pipeline: fix buffer not null terminated Thread-Index: AQHT1mq4mrKHG3bwYECw/VUIsLHasKQmBRqg Date: Tue, 8 May 2018 14:29:31 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891267BB667EA@IRSMSX108.ger.corp.intel.com> References: <20180417132825.148429-1-jasvinder.singh@intel.com> <20180417163953.72821-1-jasvinder.singh@intel.com> In-Reply-To: <20180417163953.72821-1-jasvinder.singh@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action 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 v2] examples/ip_pipeline: fix buffer not null terminated 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: , X-List-Received-Date: Tue, 08 May 2018 14:29:35 -0000 > -----Original Message----- > From: Singh, Jasvinder > Sent: Tuesday, April 17, 2018 5:40 PM > To: dev@dpdk.org > Cc: Dumitrescu, Cristian ; Richardson, Bru= ce > > Subject: [PATCH v2] examples/ip_pipeline: fix buffer not null terminated >=20 > The destination string may not have a null termination if > the source string's length is equal to the sizeof(pipeline->name). >=20 > Fix by replacing strncpy with strlcpy that guarantees NULL-termination. >=20 > Coverty issue: 272606 > Fixes: d75c371e9b46 ("examples/ip_pipeline: add pipeline object") >=20 > Signed-off-by: Jasvinder Singh > Acked-by: Bruce Richardson > --- > examples/ip_pipeline/pipeline.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/ip_pipeline/pipeline.c > b/examples/ip_pipeline/pipeline.c > index 76aa1d3..43fe867 100644 > --- a/examples/ip_pipeline/pipeline.c > +++ b/examples/ip_pipeline/pipeline.c > @@ -9,6 +9,7 @@ > #include > #include >=20 > +#include > #include > #ifdef RTE_LIBRTE_KNI > #include > @@ -129,7 +130,7 @@ pipeline_create(const char *name, struct > pipeline_params *params) > } >=20 > /* Node fill in */ > - strncpy(pipeline->name, name, sizeof(pipeline->name)); > + strlcpy(pipeline->name, name, sizeof(pipeline->name)); > pipeline->p =3D p; > pipeline->n_ports_in =3D 0; > pipeline->n_ports_out =3D 0; > -- > 2.9.3 Acked-by: Cristian.Dumitrescu Applied to next-pipeline tree, thanks!