From 9d0f83183400be105bd3cd8b9530d6eb9d678e0d Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 12 Jul 2020 17:36:05 +0100 Subject: [PATCH] jail: fix segfault with len(uidmap/gidmap) > 1 Allocate enough memory for all uidmap/gidmap entries. Fixes: ea7a790 ("jail: add support for running OCI bundle") Signed-off-by: Daniel Golle --- jail/jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jail/jail.c b/jail/jail.c index 8a2d890..aa9285c 100644 --- a/jail/jail.c +++ b/jail/jail.c @@ -1105,7 +1105,7 @@ static int parseOCIuidgidmappings(struct blob_attr *msg, bool is_gidmap) } /* allocate combined mapping string */ - map = calloc(1 + len, sizeof(char)); + map = calloc(1 + totallen, sizeof(char)); if (!map) return ENOMEM; -- 2.30.2