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 571F98D35 for ; Wed, 9 Sep 2015 20:22:28 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 09 Sep 2015 11:22:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,498,1437462000"; d="scan'208";a="641667980" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by orsmga003.jf.intel.com with ESMTP; 09 Sep 2015 11:22:27 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.12]) by IRSMSX104.ger.corp.intel.com ([163.33.3.159]) with mapi id 14.03.0224.002; Wed, 9 Sep 2015 19:22:26 +0100 From: "Dumitrescu, Cristian" To: Stephen Hemminger Thread-Topic: [PATCH 2/5] example_ip_pipeline: avoid strncpy issue Thread-Index: AQHQ5FnKwD2i6wDW1UKpXA06PVWirZ40j66Q Date: Wed, 9 Sep 2015 18:22:25 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D89126478B952D@IRSMSX108.ger.corp.intel.com> References: <1441072746-29174-1-git-send-email-stephen@networkplumber.org> <1441072746-29174-3-git-send-email-stephen@networkplumber.org> In-Reply-To: <1441072746-29174-3-git-send-email-stephen@networkplumber.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 2/5] example_ip_pipeline: avoid strncpy issue 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: Wed, 09 Sep 2015 18:22:29 -0000 > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Tuesday, September 1, 2015 4:59 AM > To: Dumitrescu, Cristian > Cc: dev@dpdk.org; Stephen Hemminger > Subject: [PATCH 2/5] example_ip_pipeline: avoid strncpy issue >=20 > If name is so long that it fills buffer, then string would not > be null terminated. >=20 > Signed-off-by: Stephen Hemminger > --- > examples/ip_pipeline/config_parse_tm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/ip_pipeline/config_parse_tm.c > b/examples/ip_pipeline/config_parse_tm.c > index 84702b0..4a35715 100644 > --- a/examples/ip_pipeline/config_parse_tm.c > +++ b/examples/ip_pipeline/config_parse_tm.c > @@ -354,7 +354,9 @@ tm_cfgfile_load_sched_subport( > profile =3D atoi(entries[j].value); > strncpy(name, > entries[j].name, > - sizeof(name)); > + CFG_NAME_LEN - 1); > + name[CFG_NAME_LEN-1] =3D '\0'; > + > n_tokens =3D rte_strsplit( > &name[sizeof("pipe")], > strnlen(name, > CFG_NAME_LEN), > -- > 2.1.4 Acked-by: Cristian Dumitrescu