From e95d3bf04d8a54af43bb8db3b8eb64d68c9f6927 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Tue, 12 Apr 2011 11:41:00 +0900 Subject: [PATCH] Fix buffer overrun in sched_getaffinity Zeroing of the cpu array should start from &cpus[kernel_ret] not &cpus[num_zeros_to_fill]. This fixes a crash in EFL's edje_cc running under qemu-arm. Signed-off-by: Mike McCormack Reviewed-by: Stefan Hajnoczi Acked-by: Mike Frysinger Signed-off-by: Riku Voipio --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e969d1b61d..5b7b8e2394 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6505,7 +6505,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, unsigned long zero = arg2 - ret; p = alloca(zero); memset(p, 0, zero); - if (copy_to_user(arg3 + zero, p, zero)) { + if (copy_to_user(arg3 + ret, p, zero)) { goto efault; } arg2 = ret; -- GitLab