From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id B0B8658FE for ; Thu, 19 Apr 2018 10:36:43 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2018 01:36:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,468,1517904000"; d="scan'208";a="48172231" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga001.fm.intel.com with ESMTP; 19 Apr 2018 01:36:42 -0700 Received: from irsmsx111.ger.corp.intel.com (10.108.20.4) by IRSMSX101.ger.corp.intel.com (163.33.3.153) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 19 Apr 2018 09:36:41 +0100 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.176]) by irsmsx111.ger.corp.intel.com ([169.254.2.167]) with mapi id 14.03.0319.002; Thu, 19 Apr 2018 09:36:40 +0100 From: "Singh, Jasvinder" To: "Pattan, Reshma" , "dev@dpdk.org" Thread-Topic: [PATCH] examples/ip_pipeline: fix buffer not null terminated Thread-Index: AQHT1zajLn4yxE0D4U+ZQEc3A37SZaQHxICw Date: Thu, 19 Apr 2018 08:36:40 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D33341978@IRSMSX101.ger.corp.intel.com> References: <1524070690-12000-1-git-send-email-reshma.pattan@intel.com> <1524070690-12000-2-git-send-email-reshma.pattan@intel.com> In-Reply-To: <1524070690-12000-2-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDAwMjhiNGMtMGQyMy00ZjcxLTg3NzktMTRlNDA3NDZjMTM1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ik5GZDRDbXQ2TWZMdHJXckthb3prbFV4QWdnU24rbWdCSzh6QXlUd0pvcTg9In0= 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:36:44 -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(kni->name) will not appen= d the > NULL to destination string. >=20 > Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees = NULL > termination. >=20 > Coverity issue: 272562 > Fixes: 9a408cc8ac ("examples/ip_pipeline: add KNI object") > CC: jasvinder.singh@intel.com >=20 > Signed-off-by: Reshma Pattan > --- > examples/ip_pipeline/kni.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/ip_pipeline/kni.c b/examples/ip_pipeline/kni.c inde= x > ed5f8942e..7e5ff0543 100644 > --- a/examples/ip_pipeline/kni.c > +++ b/examples/ip_pipeline/kni.c > @@ -7,6 +7,7 @@ >=20 > #include > #include > +#include >=20 > #include "kni.h" > #include "mempool.h" > @@ -153,7 +154,7 @@ kni_create(const char *name, struct kni_params > *params) > return NULL; >=20 > /* Node fill in */ > - strncpy(kni->name, name, sizeof(kni->name)); > + strlcpy(kni->name, name, sizeof(kni->name)); > kni->k =3D k; >=20 > /* Node add to list */ > -- > 2.14.3 Reviewed-by: Jasvinder Singh