From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dariusz Stojaczyk Subject: [PATCH v4 1/3] vhost: fix malloc in rte_vhost_get_mem_table() Date: Fri, 26 May 2017 13:59:13 +0200 Message-ID: <1495799955-190227-2-git-send-email-dariuszx.stojaczyk@intel.com> References: <1494513192-85863-1-git-send-email-dariuszx.stojaczyk@intel.com> <1495799955-190227-1-git-send-email-dariuszx.stojaczyk@intel.com> Cc: Dariusz Stojaczyk To: dev@dpdk.org Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 79C3A9B51 for ; Fri, 26 May 2017 10:18:22 +0200 (CEST) In-Reply-To: <1495799955-190227-1-git-send-email-dariuszx.stojaczyk@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Amount of allocated memory was too small, causing buffer overflow. Signed-off-by: Dariusz Stojaczyk --- v2: remove gerrit id lib/librte_vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 0b19d2e..1f565fb 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; -- 2.7.4