From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id AC0797F0C for ; Thu, 19 Apr 2018 17:33:48 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2018 08:33:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,469,1517904000"; d="scan'208";a="34894411" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by orsmga008.jf.intel.com with ESMTP; 19 Apr 2018 08:33:46 -0700 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.176]) by IRSMSX109.ger.corp.intel.com ([169.254.13.170]) with mapi id 14.03.0319.002; Thu, 19 Apr 2018 16:33:45 +0100 From: "Singh, Jasvinder" To: "Laatz, Kevin" , "dev@dpdk.org" CC: "Dumitrescu, Cristian" Thread-Topic: [PATCH] examples/ip_pipeline: fix buffer not null terminated Thread-Index: AQHT184KD1zLzMhksECJMPXWD+tVpaQIN9bA Date: Thu, 19 Apr 2018 15:33:45 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D33342BAD@IRSMSX101.ger.corp.intel.com> References: <20180419110316.7939-1-kevin.laatz@intel.com> In-Reply-To: <20180419110316.7939-1-kevin.laatz@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTliYTg1ZDAtNWM5Ny00ZDNhLWJmODktMzUzODdiMzk5OTBlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkFhZk5TUW9ocXVpNjJFUzVBOWNQYms1ckZ0aXg2WlAxaDV2OEF5Ums3Z3M9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] 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: Thu, 19 Apr 2018 15:33:49 -0000 > -----Original Message----- > From: Laatz, Kevin > Sent: Thursday, April 19, 2018 12:03 PM > To: dev@dpdk.org > Cc: Dumitrescu, Cristian ; Laatz, Kevin > ; Singh, Jasvinder > Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated >=20 > The destination string may not have a NULL termination if the source's st= ring is > equal to the sizeof(tmgr_port->name). >=20 > Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees = NULL > termination. >=20 > Coverity issue: 272592 > Fixes: 25961ff3bcb9 ("examples/ip_pipeline: add traffic manager object") > Cc: jasvinder.singh@intel.com >=20 > Signed-off-by: Kevin Laatz > --- > examples/ip_pipeline/tmgr.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c in= dex > b46ca96..40cbf1d 100644 > --- a/examples/ip_pipeline/tmgr.c > +++ b/examples/ip_pipeline/tmgr.c > @@ -4,6 +4,8 @@ >=20 > #include >=20 > +#include > + > #include "tmgr.h" >=20 > static struct rte_sched_subport_params > @@ -148,7 +150,7 @@ tmgr_port_create(const char *name, struct > tmgr_port_params *params) > } >=20 > /* Node fill in */ > - strncpy(tmgr_port->name, name, sizeof(tmgr_port->name)); > + strlcpy(tmgr_port->name, name, sizeof(tmgr_port->name)); > tmgr_port->s =3D s; > tmgr_port->n_subports_per_port =3D params->n_subports_per_port; > tmgr_port->n_pipes_per_subport =3D params->n_pipes_per_subport; > -- > 2.9.5 Reviewed-by: Jasvinder Singh