DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] test/distributor: fix sprintf with strlcpy
@ 2019-02-14  9:45 Pallantla Poornima
  2019-03-25 15:11 ` Hunt, David
  0 siblings, 1 reply; 5+ messages in thread
From: Pallantla Poornima @ 2019-02-14  9:45 UTC (permalink / raw)
  To: dev
  Cc: reshma.pattan, david.hunt, bruce.richardson, ferruh.yigit,
	Pallantla Poornima, stable

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);
-- 
2.17.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] test/distributor: fix sprintf with strlcpy
  2019-02-14  9:45 [dpdk-dev] [PATCH v2] test/distributor: fix sprintf with strlcpy Pallantla Poornima
@ 2019-03-25 15:11 ` Hunt, David
  2019-03-25 15:11   ` Hunt, David
  2019-04-04 23:55   ` Thomas Monjalon
  0 siblings, 2 replies; 5+ messages in thread
From: Hunt, David @ 2019-03-25 15:11 UTC (permalink / raw)
  To: Pallantla Poornima, dev
  Cc: reshma.pattan, bruce.richardson, ferruh.yigit, stable

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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] test/distributor: fix sprintf with strlcpy
  2019-03-25 15:11 ` Hunt, David
@ 2019-03-25 15:11   ` Hunt, David
  2019-04-04 23:55   ` Thomas Monjalon
  1 sibling, 0 replies; 5+ messages in thread
From: Hunt, David @ 2019-03-25 15:11 UTC (permalink / raw)
  To: Pallantla Poornima, dev
  Cc: reshma.pattan, bruce.richardson, ferruh.yigit, stable

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>





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] test/distributor: fix sprintf with strlcpy
  2019-03-25 15:11 ` Hunt, David
  2019-03-25 15:11   ` Hunt, David
@ 2019-04-04 23:55   ` Thomas Monjalon
  2019-04-04 23:55     ` Thomas Monjalon
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2019-04-04 23:55 UTC (permalink / raw)
  To: Pallantla Poornima
  Cc: dev, Hunt, David, reshma.pattan, bruce.richardson, ferruh.yigit, stable

25/03/2019 16:11, Hunt, David:
> 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.
> > ---
> 
> Acked-by: David Hunt <david.hunt@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] test/distributor: fix sprintf with strlcpy
  2019-04-04 23:55   ` Thomas Monjalon
@ 2019-04-04 23:55     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2019-04-04 23:55 UTC (permalink / raw)
  To: Pallantla Poornima
  Cc: dev, Hunt, David, reshma.pattan, bruce.richardson, ferruh.yigit, stable

25/03/2019 16:11, Hunt, David:
> 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.
> > ---
> 
> Acked-by: David Hunt <david.hunt@intel.com>

Applied, thanks



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-04 23:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-14  9:45 [dpdk-dev] [PATCH v2] test/distributor: fix sprintf with strlcpy Pallantla Poornima
2019-03-25 15:11 ` Hunt, David
2019-03-25 15:11   ` Hunt, David
2019-04-04 23:55   ` Thomas Monjalon
2019-04-04 23:55     ` Thomas Monjalon

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).