[dpdk-dev] [PATCH] test/distributor: fix sprintf with snprintf

Pallantla Poornima pallantlax.poornima at intel.com
Wed Feb 6 11:39:07 CET 2019


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

Fixes: f74df2c57e ("test/distributor: test single and burst API")
Cc: stable at dpdk.org

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

diff --git a/test/test/test_distributor.c b/test/test/test_distributor.c
index 98919ec0c..03df32b05 100644
--- a/test/test/test_distributor.c
+++ b/test/test/test_distributor.c
@@ -642,9 +642,11 @@ test_distributor(void)
 
 		worker_params.dist = dist[i];
 		if (i)
-			sprintf(worker_params.name, "burst");
+			snprintf(worker_params.name,
+					sizeof(worker_params.name), "burst");
 		else
-			sprintf(worker_params.name, "single");
+			snprintf(worker_params.name,
+					sizeof(worker_params.name), "single");
 
 		rte_eal_mp_remote_launch(handle_work,
 				&worker_params, SKIP_MASTER);
-- 
2.17.2



More information about the dev mailing list