[dpdk-dev] [PATCH v2] examples/vm_power: fix strcpy buffer overrun

Hunt, David david.hunt at intel.com
Tue Jul 16 13:23:26 CEST 2019


On 16/07/2019 12:05, Thomas Monjalon wrote:
> 16/07/2019 10:24, David Hunt:
>> 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.
> [...]
>> --- a/examples/vm_power_manager/guest_cli/main.c
>> +++ b/examples/vm_power_manager/guest_cli/main.c
>> -			strcpy(policy->vm_name, optarg);
>> +			rte_strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ);
> This is still using rte_strlcpy !!


Apologies, too many balls in the air.  v3 pushed.




More information about the dev mailing list