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 040B87F0C for ; Thu, 19 Apr 2018 17:34:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2018 08:34:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,469,1517904000"; d="scan'208";a="217842083" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by orsmga005.jf.intel.com with ESMTP; 19 Apr 2018 08:34:25 -0700 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.176]) by irsmsx105.ger.corp.intel.com ([169.254.7.163]) with mapi id 14.03.0319.002; Thu, 19 Apr 2018 16:34:18 +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: AQHT183GudXuln0tfU6Heq6F5b+Ea6QIOAJg Date: Thu, 19 Apr 2018 15:34:18 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D33342BBB@IRSMSX101.ger.corp.intel.com> References: <20180419110125.7759-1-kevin.laatz@intel.com> In-Reply-To: <20180419110125.7759-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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjAzM2U5OWYtYTk4My00OGNhLWJmOTctNWVjZjM5MzM3ZmQzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Iis4VFByMHBDVTJRTzU2aTlDQ1hLWVBhRWdWZFcwS0FLemJwMVBvNWNPaGs9In0= 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:34:27 -0000 > -----Original Message----- > From: Laatz, Kevin > Sent: Thursday, April 19, 2018 12:01 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(mempool->name). >=20 > Using strlcpy in place of strncpy fixes this issue as strlcpy guarantees = NULL > termination. >=20 > Coverity issue: 272588 > Fixes: 6bfe74f8c93e ("examples/ip_pipeline: add mempool object") > Cc: jasvinder.singh@intel.com >=20 > Signed-off-by: Kevin Laatz > --- > examples/ip_pipeline/mempool.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/ip_pipeline/mempool.c > b/examples/ip_pipeline/mempool.c index 33b9243..f5d2a7d 100644 > --- a/examples/ip_pipeline/mempool.c > +++ b/examples/ip_pipeline/mempool.c > @@ -6,6 +6,7 @@ > #include >=20 > #include > +#include >=20 > #include "mempool.h" >=20 > @@ -70,7 +71,7 @@ mempool_create(const char *name, struct > mempool_params *params) > } >=20 > /* Node fill in */ > - strncpy(mempool->name, name, sizeof(mempool->name)); > + strlcpy(mempool->name, name, sizeof(mempool->name)); > mempool->m =3D m; > mempool->buffer_size =3D params->buffer_size; >=20 > -- > 2.9.5 Reviewed-by: Jasvinder Singh