From: Jasvinder Singh Subject: [PATCH] examples/ip_pipeline: fix buffer not null terminated Date: Tue, 17 Apr 2018 14:28:25 +0100 Message-ID: <20180417132825.148429-1-jasvinder.singh@intel.com> Cc: cristian.dumitrescu@intel.com To: dev@dpdk.org Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 141AE8E73 for ; Tue, 17 Apr 2018 15:28:27 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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