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 <dariuszx.stojaczyk@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2017-05-08 09:43:05 -07:00 committed by Jim Harris
parent 2542779301
commit 13657c7d75

View File

@ -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;