From: Dariusz Stojaczyk Date: Fri, 26 May 2017 11:59:13 +0000 (+0200) Subject: vhost: fix malloc size too small X-Git-Tag: spdx-start~2995 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d1b2842a9dcf1e7957a185be126f4af9885f9cf7;p=dpdk.git vhost: fix malloc size too small Amount of allocated memory was too small, causing buffer overflow. Fixes: eb32247457fe ("vhost: export guest memory regions") Cc: stable@dpdk.org Signed-off-by: Dariusz Stojaczyk Reviewed-by: Jens Freimann Acked-by: Yuanhan Liu --- diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 1b8e6bd70a..19c5a43a51 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/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;