From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 759F48DB3 for ; Tue, 17 Apr 2018 17:02:07 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2018 08:01:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,463,1517904000"; d="scan'208";a="46867145" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.51]) by fmsmga004.fm.intel.com with SMTP; 17 Apr 2018 08:01:15 -0700 Received: by (sSMTP sendmail emulation); Tue, 17 Apr 2018 16:01:14 +0100 Date: Tue, 17 Apr 2018 16:01:14 +0100 From: Bruce Richardson To: Jasvinder Singh Cc: dev@dpdk.org, cristian.dumitrescu@intel.com Message-ID: <20180417150114.GC89464@bricha3-MOBL.ger.corp.intel.com> References: <20180417132825.148429-1-jasvinder.singh@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180417132825.148429-1-jasvinder.singh@intel.com> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.4 (2018-02-28) 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: Tue, 17 Apr 2018 15:02:07 -0000 On Tue, Apr 17, 2018 at 02:28:25PM +0100, Jasvinder Singh wrote: > The destination string may not have a null termination if > the source string's length is equal to the sizeof(pipeline->name). > > Fix by replacing strncpy with strlcpy that guarantees NULL-termination. > > Coverty issue: 272606 > Fixes: d75c371e9b46 ("examples/ip_pipeline: add pipeline object") > > Signed-off-by: Jasvinder Singh Does this need an include of rte_string_fns.h? In terms of the change itself: Acked-by: Bruce Richardson > --- > examples/ip_pipeline/pipeline.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c > index 76aa1d3..132f1a8 100644 > --- a/examples/ip_pipeline/pipeline.c > +++ b/examples/ip_pipeline/pipeline.c > @@ -129,7 +129,7 @@ pipeline_create(const char *name, struct pipeline_params *params) > } > > /* Node fill in */ > - strncpy(pipeline->name, name, sizeof(pipeline->name)); > + strlcpy(pipeline->name, name, sizeof(pipeline->name)); > pipeline->p = p; > pipeline->n_ports_in = 0; > pipeline->n_ports_out = 0; > -- > 2.9.3 >