patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v1] examples/vm_power: fix strcpy buffer overrun
@ 2019-07-12 14:04 David Hunt
  2019-07-12 14:14 ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: David Hunt @ 2019-07-12 14:04 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable

replace strcpy with rte_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]

Cc: stable@dpdk.org
Fixes: 59287933a0bb ("examples/vm_power: add options to guest app")
Signed-off-by: David Hunt <david.hunt@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..a18eb214a 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -65,7 +65,7 @@ parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'n':
-			strcpy(policy->vm_name, optarg);
+			rte_strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ);
 			printf("Setting VM Name to [%s]\n", policy->vm_name);
 			break;
 		case 'b':
-- 
2.17.1


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

end of thread, other threads:[~2019-07-16 11:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 14:04 [dpdk-stable] [PATCH v1] examples/vm_power: fix strcpy buffer overrun David Hunt
2019-07-12 14:14 ` [dpdk-stable] [dpdk-dev] " Burakov, Anatoly
2019-07-12 14:47 ` Bruce Richardson
2019-07-14 13:26   ` Thomas Monjalon
2019-07-16  8:24 ` [dpdk-stable] [PATCH v2] " David Hunt
2019-07-16 11:05   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2019-07-16 11:23     ` Hunt, David
2019-07-16 11:19   ` [dpdk-stable] [PATCH v3] " David Hunt
2019-07-16 11:28     ` [dpdk-stable] [dpdk-dev] " 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).