[dpdk-stable] patch 'examples/power: fix strcpy buffer overrun' has been queued to LTS release 18.11.3

Kevin Traynor ktraynor at redhat.com
Tue Aug 27 11:30:24 CEST 2019


Hi,

FYI, your patch has been queued to LTS release 18.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 09/03/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/29f6c01ad677f5693d2cba9e89f8d490c209cb99

Thanks.

Kevin Traynor

---
>From 29f6c01ad677f5693d2cba9e89f8d490c209cb99 Mon Sep 17 00:00:00 2001
From: David Hunt <david.hunt at intel.com>
Date: Tue, 16 Jul 2019 12:19:00 +0100
Subject: [PATCH] examples/power: fix strcpy buffer overrun

[ upstream commit 135393d4560bcffaa3fe0b739d26591565a320a2 ]

replace strcpy with strlcpy to prevent buffer overrun
With fix, attempting to use a VERY lonng vm name results in a nicely
truncated 32 character name rather than a segfault:
Setting VM Name to [sdfdsfsfsdffdsdsasdsadasdakjshd]

Using strlcpy rather than rte_strlcpy, as the rte_ version is only a
fallback.

As well as the fix in main.c, this patch also changes an occurrence of
rte_strlcpy in channel_manager.c and channel_monitor.c to strlcpy.

Fixes: 59287933a0bb ("examples/vm_power: add options to guest app")

Signed-off-by: David Hunt <david.hunt at intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 examples/vm_power_manager/guest_cli/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index 36365b124..2094145eb 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -66,5 +66,5 @@ parse_args(int argc, char **argv)
 		/* portmask */
 		case 'n':
-			strcpy(policy->vm_name, optarg);
+			strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ);
 			printf("Setting VM Name to [%s]\n", policy->vm_name);
 			break;
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-08-27 09:40:13.475508439 +0100
+++ 0047-examples-power-fix-strcpy-buffer-overrun.patch	2019-08-27 09:40:10.948143708 +0100
@@ -1 +1 @@
-From 135393d4560bcffaa3fe0b739d26591565a320a2 Mon Sep 17 00:00:00 2001
+From 29f6c01ad677f5693d2cba9e89f8d490c209cb99 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 135393d4560bcffaa3fe0b739d26591565a320a2 ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -23,27 +24,3 @@
- examples/vm_power_manager/channel_manager.c | 2 +-
- examples/vm_power_manager/channel_monitor.c | 2 +-
- examples/vm_power_manager/guest_cli/main.c  | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
-index 2c1332257..4db225755 100644
---- a/examples/vm_power_manager/channel_manager.c
-+++ b/examples/vm_power_manager/channel_manager.c
-@@ -589,5 +589,5 @@ add_host_channels(void)
- 		}
- 		chan_infos[i] = chan_info;
--		rte_strlcpy(chan_info->channel_path, socket_path,
-+		strlcpy(chan_info->channel_path, socket_path,
- 				sizeof(chan_info->channel_path));
- 
-diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
-index 9d7474da0..496772f8a 100644
---- a/examples/vm_power_manager/channel_monitor.c
-+++ b/examples/vm_power_manager/channel_monitor.c
-@@ -310,5 +310,5 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
- 			return -1;
- 		}
--		rte_strlcpy(pkt->vm_name, vm_name, VM_MAX_NAME_SZ);
-+		strlcpy(pkt->vm_name, vm_name, VM_MAX_NAME_SZ);
- 		pkt->resource_id = resource_id;
- 	}
+ examples/vm_power_manager/guest_cli/main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+


More information about the stable mailing list