[dpdk-stable] patch 'test/hash: replace sprintf with snprintf' has been queued to LTS release 18.11.2

Kevin Traynor ktraynor at redhat.com
Thu Apr 25 17:40:27 CEST 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/01/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches can be viewed on the 18.11 branch at:
	https://github.com/kevintraynor/dpdk-stable-queue.git

Thanks.

Kevin Traynor

---
>From 994a1345da0b6c33dc0e4a3cd2b1d89c31d2e848 Mon Sep 17 00:00:00 2001
From: Pallantla Poornima <pallantlax.poornima at intel.com>
Date: Tue, 26 Mar 2019 10:27:23 +0000
Subject: [PATCH] test/hash: replace sprintf with snprintf

[ upstream commit 8766e2a4782aecb6d474697617055e281149cc02 ]

sprintf function is not secure as it doesn't check the length of string.
More secure function snprintf is used.

Fixes: 473d1bebce ("hash: allow to store data in hash table")

Signed-off-by: Pallantla Poornima <pallantlax.poornima at intel.com>
Acked-by: Yipeng Wang <yipeng1.wang at intel.com>
---
 test/test/test_hash_perf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/test/test_hash_perf.c b/test/test/test_hash_perf.c
index 525211180..5648fce02 100644
--- a/test/test/test_hash_perf.c
+++ b/test/test/test_hash_perf.c
@@ -86,7 +86,9 @@ create_table(unsigned int with_data, unsigned int table_index,
 	if (with_data)
 		/* Table will store 8-byte data */
-		sprintf(name, "test_hash%d_data", hashtest_key_lens[table_index]);
+		snprintf(name, sizeof(name), "test_hash%u_data",
+				hashtest_key_lens[table_index]);
 	else
-		sprintf(name, "test_hash%d", hashtest_key_lens[table_index]);
+		snprintf(name, sizeof(name), "test_hash%u",
+				hashtest_key_lens[table_index]);
 
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-04-25 16:37:48.990147635 +0100
+++ 0052-test-hash-replace-sprintf-with-snprintf.patch	2019-04-25 16:37:46.769294400 +0100
@@ -1 +1 @@
-From 8766e2a4782aecb6d474697617055e281149cc02 Mon Sep 17 00:00:00 2001
+From 994a1345da0b6c33dc0e4a3cd2b1d89c31d2e848 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 8766e2a4782aecb6d474697617055e281149cc02 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org
@@ -15 +16 @@
- app/test/test_hash_perf.c | 6 ++++--
+ test/test/test_hash_perf.c | 6 ++++--
@@ -18 +19 @@
-diff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c
+diff --git a/test/test/test_hash_perf.c b/test/test/test_hash_perf.c
@@ -20,2 +21,2 @@
---- a/app/test/test_hash_perf.c
-+++ b/app/test/test_hash_perf.c
+--- a/test/test/test_hash_perf.c
++++ b/test/test/test_hash_perf.c


More information about the stable mailing list