From 13657c7d75fa5dcdaa4466ab8ed6a76e80dee5d2 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Mon, 8 May 2017 09:43:05 -0700 Subject: [PATCH] vhost: fix malloc in rte_vhost_get_mem_table Amount of allocated memory was too small, causing buffer overflow. Change-Id: Ib43e0a9040f594fed0a8c5660a45aeb07e4400c7 Signed-off-by: Dariusz Stojaczyk --- lib/vhost/rte_vhost_17_05/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vhost/rte_vhost_17_05/vhost.c b/lib/vhost/rte_vhost_17_05/vhost.c index dc63208b09..74c12040ee 100644 --- a/lib/vhost/rte_vhost_17_05/vhost.c +++ b/lib/vhost/rte_vhost_17_05/vhost.c @@ -369,7 +369,7 @@ rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem) return -1; size = dev->mem->nregions * sizeof(struct rte_vhost_mem_region); - m = malloc(size); + m = malloc(sizeof(struct rte_vhost_memory) + size); if (!m) return -1;