From effdb147868af6df3e645d82e2d7c3544f44a786 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 11 Jan 2024 19:12:24 +0100 Subject: [PATCH] lib/idmapping.c: write_mapping(): Fixx off-by-one bug Link: Cc: Serge Hallyn Cc: "Eric W. Biederman" Signed-off-by: Alejandro Colomar --- lib/idmapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/idmapping.c b/lib/idmapping.c index 7454c3d81..c861beb65 100644 --- a/lib/idmapping.c +++ b/lib/idmapping.c @@ -192,7 +192,7 @@ void write_mapping(int proc_dir_fd, int ranges, const struct map_range *mappings } #endif - bufsize = ranges * ((ULONG_DIGITS + 1) * 3); + bufsize = (ULONG_DIGITS + 1) * 3 * ranges + 1; pos = buf = XMALLOC(bufsize, char); end = buf + bufsize; -- 2.47.2