From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id BF8CE2BF7; Mon, 25 Mar 2019 16:11:32 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 08:11:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,269,1549958400"; d="scan'208";a="143666391" Received: from dhunt5-mobl2.ger.corp.intel.com (HELO [10.237.210.26]) ([10.237.210.26]) by FMSMGA003.fm.intel.com with ESMTP; 25 Mar 2019 08:11:29 -0700 To: Pallantla Poornima , dev@dpdk.org Cc: reshma.pattan@intel.com, bruce.richardson@intel.com, ferruh.yigit@intel.com, stable@dpdk.org References: <1550137549-5184-1-git-send-email-pallantlax.poornima@intel.com> From: "Hunt, David" Message-ID: <30b77705-4909-854b-303c-d3241231827b@intel.com> Date: Mon, 25 Mar 2019 15:11:29 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <1550137549-5184-1-git-send-email-pallantlax.poornima@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v2] test/distributor: fix sprintf with strlcpy 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: Mon, 25 Mar 2019 15:11:33 -0000 Hi Poornima, On 14/2/2019 9:45 AM, Pallantla Poornima wrote: > 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); Acked-by: David Hunt From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 5BAF4A05D3 for ; Mon, 25 Mar 2019 16:11:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 66E232C2F; Mon, 25 Mar 2019 16:11:34 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id BF8CE2BF7; Mon, 25 Mar 2019 16:11:32 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2019 08:11:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,269,1549958400"; d="scan'208";a="143666391" Received: from dhunt5-mobl2.ger.corp.intel.com (HELO [10.237.210.26]) ([10.237.210.26]) by FMSMGA003.fm.intel.com with ESMTP; 25 Mar 2019 08:11:29 -0700 To: Pallantla Poornima , dev@dpdk.org Cc: reshma.pattan@intel.com, bruce.richardson@intel.com, ferruh.yigit@intel.com, stable@dpdk.org References: <1550137549-5184-1-git-send-email-pallantlax.poornima@intel.com> From: "Hunt, David" Message-ID: <30b77705-4909-854b-303c-d3241231827b@intel.com> Date: Mon, 25 Mar 2019 15:11:29 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <1550137549-5184-1-git-send-email-pallantlax.poornima@intel.com> Content-Type: text/plain; charset="UTF-8"; format="flowed" Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v2] test/distributor: fix sprintf with strlcpy 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190325151129.kdz-OL59r1bKOgciKjuecHoALoud_0zsGaU7mIB8VGQ@z> Hi Poornima, On 14/2/2019 9:45 AM, Pallantla Poornima wrote: > 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); Acked-by: David Hunt