diff --git a/lib/idmapping.c b/lib/idmapping.c index 7454c3d8..c861beb6 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;