From: Reshma Pattan Date: Wed, 10 Apr 2019 14:54:31 +0000 (+0100) Subject: examples/power: fix string overflow X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=57fad3e25fee6400af07a917e876ef8e4ee0e653;p=dpdk.git examples/power: fix string overflow Use strlcpy instead of strcpy to fix string overflow. Coverity issue: 337671 Fixes: a63504a90f ("examples/power: add JSON string handling") Cc: stable@dpdk.org Signed-off-by: Reshma Pattan Acked-by: David Hunt --- diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index bc5679d4b5..971e4f2bcd 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -159,7 +159,8 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt) if (ret) return ret; } else if (!strcmp(key, "name")) { - strcpy(pkt->vm_name, json_string_value(value)); + strlcpy(pkt->vm_name, json_string_value(value), + sizeof(pkt->vm_name)); } else if (!strcmp(key, "command")) { char command[32]; strlcpy(command, json_string_value(value), 32);