[Devel] [PATCH 1/1] exec: fix memory allocation size in the alloc_exec_handle()

Denis V. Lunev den at openvz.org
Fri Dec 9 12:45:51 MSK 2022


We have heap corruption here for sure.

Signed-off-by: Denis V. Lunev <den at openvz.org>
---
 lib/exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/exec.c b/lib/exec.c
index e22a950..769d09e 100644
--- a/lib/exec.c
+++ b/lib/exec.c
@@ -1285,7 +1285,7 @@ int vzctl2_wrap_exec_script(char *const argv[], char *const env[], int flags)
 static struct vzctl_exec_handle *alloc_exec_handle(void)
 {
 	struct vzctl_exec_handle *h;
-	h = calloc(1, sizeof(struct vzctl_exec_handle *));
+	h = calloc(1, sizeof(struct vzctl_exec_handle));
 	if (h == NULL) {
 		vzctl_err(VZCTL_E_NOMEM, ENOMEM, "alloc_exec_handle");
 		return NULL;
-- 
2.34.1



More information about the Devel mailing list