examples/power: fix strcpy buffer overrun
authorDavid Hunt <david.hunt@intel.com>
Tue, 16 Jul 2019 11:19:00 +0000 (12:19 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 16 Jul 2019 11:30:58 +0000 (13:30 +0200)
commit135393d4560bcffaa3fe0b739d26591565a320a2
tree41466bd4c421801fc16183e8452e4cdb248a59de
parentd601426a2711f396201817bb077ec4f73c3faffe
examples/power: fix strcpy buffer overrun

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")
Cc: stable@dpdk.org
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
examples/vm_power_manager/channel_manager.c
examples/vm_power_manager/channel_monitor.c
examples/vm_power_manager/guest_cli/main.c