From: Pallantla Poornima Date: Mon, 4 Feb 2019 07:28:06 +0000 (+0000) Subject: vhost: fix sprintf with snprintf X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7c7b7562252742a6c298de64df486873336fd058;p=dpdk.git vhost: fix sprintf with snprintf sprintf function is not secure as it doesn't check the length of string. More secure function snprintf is used. Fixes: d7280c9fffcb ("vhost: support selective datapath") Cc: stable@dpdk.org Signed-off-by: Pallantla Poornima Reviewed-by: Maxime Coquelin Acked-by: Tiwei Bie --- diff --git a/lib/librte_vhost/vdpa.c b/lib/librte_vhost/vdpa.c index 1ff9b00b84..321e11f178 100644 --- a/lib/librte_vhost/vdpa.c +++ b/lib/librte_vhost/vdpa.c @@ -66,7 +66,7 @@ rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr, if (i == MAX_VHOST_DEVICE) return -1; - sprintf(device_name, "vdpa-dev-%d", i); + snprintf(device_name, sizeof(device_name), "vdpa-dev-%d", i); dev = rte_zmalloc(device_name, sizeof(struct rte_vdpa_device), RTE_CACHE_LINE_SIZE); if (!dev)