patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Hunt, David" <david.hunt@intel.com>
To: Pallantla Poornima <pallantlax.poornima@intel.com>, dev@dpdk.org
Cc: reshma.pattan@intel.com, bruce.richardson@intel.com,
	ferruh.yigit@intel.com, stable@dpdk.org
Subject: Re: [dpdk-stable] [PATCH v2] test/distributor: fix sprintf with strlcpy
Date: Mon, 25 Mar 2019 15:11:29 +0000	[thread overview]
Message-ID: <30b77705-4909-854b-303c-d3241231827b@intel.com> (raw)
In-Reply-To: <1550137549-5184-1-git-send-email-pallantlax.poornima@intel.com>

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 <pallantlax.poornima@intel.com>
> ---
> 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 <rte_mempool.h>
>   #include <rte_mbuf.h>
>   #include <rte_distributor.h>
> +#include <rte_string_fns.h>
>   
>   #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 <david.hunt@intel.com>





  reply	other threads:[~2019-03-25 15:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14  9:45 Pallantla Poornima
2019-03-25 15:11 ` Hunt, David [this message]
2019-04-04 23:55   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30b77705-4909-854b-303c-d3241231827b@intel.com \
    --to=david.hunt@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=pallantlax.poornima@intel.com \
    --cc=reshma.pattan@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).