From patchwork Fri Dec 11 16:01:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Zhang X-Patchwork-Id: 9502 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id DE8938E7A; Fri, 11 Dec 2015 17:02:41 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 733488E72 for ; Fri, 11 Dec 2015 17:02:40 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 11 Dec 2015 08:01:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,414,1444719600"; d="scan'208";a="871708036" Received: from sie-lab-212-033.ir.intel.com (HELO silpixa00383881.ir.intel.com) ([10.237.212.33]) by fmsmga002.fm.intel.com with ESMTP; 11 Dec 2015 08:01:43 -0800 From: Fan Zhang To: dev@dpdk.org Date: Fri, 11 Dec 2015 16:01:42 +0000 Message-Id: <1449849702-30365-1-git-send-email-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.5.0 Subject: [dpdk-dev] [PATCH] example/ip_pipeline: fix copy into fixed size buffer defect X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Coverity issue: 107133 Fixes: eb32fe7c5574 ("examples/ip_pipeline: rework initialization parameters") Signed-off-by: Fan Zhang Acked-by: Cristian Dumitrescu Acked-by: John McNamara --- *v2 fixed bug: fix possible buff not null terminated bug examples/ip_pipeline/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index bc6d6d9..cabc4f7 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -1068,7 +1068,8 @@ static void app_pipeline_params_get(struct app_params *app, uint32_t i; uint32_t mempool_id; - strcpy(p_out->name, p_in->name); + strncpy(p_out->name, p_in->name, PIPELINE_NAME_SIZE); + p_out->name[PIPELINE_NAME_SIZE - 1] = '\0'; p_out->socket_id = (int) p_in->socket_id;