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 051F61B1E6; Thu, 14 Feb 2019 10:46:31 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2019 01:46:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,368,1544515200"; d="scan'208";a="143382378" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 14 Feb 2019 01:46:29 -0800 Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com [10.102.246.100]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x1E9kTof026145; Thu, 14 Feb 2019 09:46:29 GMT Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x1E9jriB005351; Thu, 14 Feb 2019 09:45:53 GMT Received: (from ppoornix@localhost) by wgcvswdev001.ir.intel.com with œ id x1E9jq8c005346; Thu, 14 Feb 2019 09:45:52 GMT From: Pallantla Poornima To: dev@dpdk.org Cc: reshma.pattan@intel.com, david.hunt@intel.com, bruce.richardson@intel.com, ferruh.yigit@intel.com, Pallantla Poornima , stable@dpdk.org Date: Thu, 14 Feb 2019 09:45:49 +0000 Message-Id: <1550137549-5184-1-git-send-email-pallantlax.poornima@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: Subject: [dpdk-stable] [PATCH v2] test/distributor: fix sprintf with strlcpy X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2019 09:46:32 -0000 sprintf function is not secure as it doesn't check the length of string. replaced sprintf with strlcpy. Fixes: f74df2c57e ("test/distributor: test single and burst API") Cc: stable@dpdk.org Signed-off-by: Pallantla Poornima --- v2: Addressed review comment to replace snprintf to strlcpy. --- test/test/test_distributor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test/test_distributor.c b/test/test/test_distributor.c index 98919ec0c..da3348fd1 100644 --- a/test/test/test_distributor.c +++ b/test/test/test_distributor.c @@ -11,6 +11,7 @@ #include #include #include +#include #define ITER_POWER 20 /* log 2 of how many iterations we do when timing. */ #define BURST 32 @@ -642,9 +643,11 @@ test_distributor(void) worker_params.dist = dist[i]; if (i) - sprintf(worker_params.name, "burst"); + strlcpy(worker_params.name, "burst", + sizeof(worker_params.name)); else - sprintf(worker_params.name, "single"); + strlcpy(worker_params.name, "single", + sizeof(worker_params.name)); rte_eal_mp_remote_launch(handle_work, &worker_params, SKIP_MASTER); -- 2.17.2