[dpdk-stable] patch 'app/bbdev: replace sprintf with snprintf or strlcpy' has been queued to LTS release 18.11.2

Kevin Traynor ktraynor at redhat.com
Wed May 8 12:15:09 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/13/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 are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/1fa39537a7b8c6df6de07fa2a245be93abd8a581

Thanks.

Kevin Traynor

---
>From 1fa39537a7b8c6df6de07fa2a245be93abd8a581 Mon Sep 17 00:00:00 2001
From: Pallantla Poornima <pallantlax.poornima at intel.com>
Date: Tue, 9 Apr 2019 14:05:40 +0100
Subject: [PATCH] app/bbdev: replace sprintf with snprintf or strlcpy

[ upstream commit cde417155fa3dd351c230731ddfc8db3f57db227 ]

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

Fixes: f714a18885 ("app/testbbdev: add test application for bbdev")

Signed-off-by: Pallantla Poornima <pallantlax.poornima at intel.com>
Acked-by: Amr Mokhtar <amr.mokhtar at intel.com>
---
 app/test-bbdev/test_bbdev.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c
index a914817bc..137c74cde 100644
--- a/app/test-bbdev/test_bbdev.c
+++ b/app/test-bbdev/test_bbdev.c
@@ -15,4 +15,6 @@
 #include <rte_bbdev_op.h>
 #include <rte_bbdev_pmd.h>
+#include<string.h>
+#include <rte_string_fns.h>
 
 #include "main.h"
@@ -789,5 +791,5 @@ test_bbdev_driver_init(void)
 	/* Initialize the maximum amount of devices */
 	do {
-		sprintf(name_tmp, "%s%i", "name_", num_devs);
+		snprintf(name_tmp, sizeof(name_tmp), "%s%i", "name_", num_devs);
 		dev2 = rte_bbdev_allocate(name_tmp);
 		TEST_ASSERT(dev2 != NULL,
@@ -796,5 +798,5 @@ test_bbdev_driver_init(void)
 	} while (num_devs < (RTE_BBDEV_MAX_DEVS - 1));
 
-	sprintf(name_tmp, "%s%i", "name_", num_devs);
+	snprintf(name_tmp, sizeof(name_tmp), "%s%i", "name_", num_devs);
 	dev2 = rte_bbdev_allocate(name_tmp);
 	TEST_ASSERT(dev2 == NULL, "Failed to initialize bbdev driver number %d "
@@ -805,5 +807,5 @@ test_bbdev_driver_init(void)
 
 	while (num_devs >= num_devs_tmp) {
-		sprintf(name_tmp, "%s%i", "name_", num_devs);
+		snprintf(name_tmp, sizeof(name_tmp), "%s%i", "name_", num_devs);
 		dev2 = rte_bbdev_get_named_dev(name_tmp);
 		TEST_ASSERT_SUCCESS(rte_bbdev_release(dev2),
@@ -826,5 +828,5 @@ test_bbdev_driver_init(void)
 			"Failed to uninitialize bbdev driver with NULL bbdev");
 
-	sprintf(name_tmp, "%s", "invalid_name");
+	strlcpy(name_tmp, "invalid_name", sizeof(name_tmp));
 	dev2 = rte_bbdev_get_named_dev(name_tmp);
 	TEST_ASSERT_FAIL(rte_bbdev_release(dev2),
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-05-08 11:05:07.181621673 +0100
+++ 0027-app-bbdev-replace-sprintf-with-snprintf-or-strlcpy.patch	2019-05-08 11:05:05.811933138 +0100
@@ -1 +1 @@
-From cde417155fa3dd351c230731ddfc8db3f57db227 Mon Sep 17 00:00:00 2001
+From 1fa39537a7b8c6df6de07fa2a245be93abd8a581 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit cde417155fa3dd351c230731ddfc8db3f57db227 ]
+
@@ -10 +11,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list