From a3a67f54f0b4ec98ff2380a792e5bfeebc47d554 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 27 Mar 2023 20:31:01 +0000 Subject: linux-user: Pass last not end to probe_guest_base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass the address of the last byte of the image, rather than the first address past the last byte. This avoids overflow when the last page of the address space is involved. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/flatload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-user/flatload.c') diff --git a/linux-user/flatload.c b/linux-user/flatload.c index e99570ca18..5efec2630e 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -448,7 +448,7 @@ static int load_flat_file(struct linux_binprm * bprm, * Allocate the address space. */ probe_guest_base(bprm->filename, 0, - text_len + data_len + extra + indx_len); + text_len + data_len + extra + indx_len - 1); /* * there are a couple of cases here, the separate code/data -- cgit 1.4.1