From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 683E17E93 for ; Thu, 19 Apr 2018 10:35:29 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2018 01:35:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,468,1517904000"; d="scan'208";a="221635912" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by fmsmga005.fm.intel.com with ESMTP; 19 Apr 2018 01:35:27 -0700 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.176]) by IRSMSX103.ger.corp.intel.com ([169.254.3.61]) with mapi id 14.03.0319.002; Thu, 19 Apr 2018 09:35:26 +0100 From: "Singh, Jasvinder" To: "Pattan, Reshma" , "dev@dpdk.org" Thread-Topic: [PATCH] examples/ip_pipeline: fix buffer not null terminated Thread-Index: AQHT1zalB5KjZJOzGEqWBRQtiuW2vaQHw8Mw Date: Thu, 19 Apr 2018 08:35:26 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D33341956@IRSMSX101.ger.corp.intel.com> References: <1524070690-12000-1-git-send-email-reshma.pattan@intel.com> <1524070690-12000-4-git-send-email-reshma.pattan@intel.com> In-Reply-To: <1524070690-12000-4-git-send-email-reshma.pattan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTAxNGY0MjMtZjBjNi00OTE4LTg5NmEtNjMxYzRhZjA0NTJmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IitSSHlcLzQ1SkhzZVRja282b2VNWTlWaTY0T3FKVFJwUHlVenN4THZadndFPSJ9 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 08:35:30 -0000 > -----Original Message----- > From: Pattan, Reshma > Sent: Wednesday, April 18, 2018 5:58 PM > To: dev@dpdk.org > Cc: Singh, Jasvinder ; Pattan, Reshma > > Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated >=20 > Copying source string of length equal to sizeof(profile->name) will not a= ppend > the NULL in destination. >=20 > Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees = NULL > termination. >=20 > Coverity issue: 272580 > Fixes: 719374345c ("examples/ip_pipeline: add action profile objects") > CC: jasvinder.singh@intel.com >=20 > Signed-off-by: Reshma Pattan > --- > examples/ip_pipeline/action.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/ip_pipeline/action.c b/examples/ip_pipeline/action.= c > index 77a04fe19..d2cd7286c 100644 > --- a/examples/ip_pipeline/action.c > +++ b/examples/ip_pipeline/action.c > @@ -6,6 +6,8 @@ > #include > #include >=20 > +#include > + > #include "action.h" > #include "hash_func.h" >=20 > @@ -345,7 +347,7 @@ table_action_profile_create(const char *name, > } >=20 > /* Node fill in */ > - strncpy(profile->name, name, sizeof(profile->name)); > + strlcpy(profile->name, name, sizeof(profile->name)); > memcpy(&profile->params, params, sizeof(*params)); > profile->ap =3D ap; >=20 > -- > 2.14.3 Reviewed-by: Jasvinder Singh