lib/idmapping.c: write_mapping(): Fixx off-by-one bug

Link: <673c2a6f9a (r136830993)>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-01-11 19:12:24 +01:00
committed by Serge Hallyn
parent 6bec1cf37c
commit effdb14786

View File

@@ -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;