From da94d26390b292f2b9d90aee2936d8545364d5a2 Mon Sep 17 00:00:00 2001 From: pbrook Date: Fri, 30 May 2008 18:24:00 +0000 Subject: Handle NULL argp/envp in execve syscall. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4627 c046a42c-6fe2-441c-8c8c-71466251a162 --- linux-user/syscall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'linux-user') diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 618e57ef23..0654f07a65 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3248,7 +3248,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, argc = 0; guest_argp = arg2; - for (gp = guest_argp; ; gp += sizeof(abi_ulong)) { + for (gp = guest_argp; gp; gp += sizeof(abi_ulong)) { if (get_user_ual(addr, gp)) goto efault; if (!addr) @@ -3257,7 +3257,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } envc = 0; guest_envp = arg3; - for (gp = guest_envp; ; gp += sizeof(abi_ulong)) { + for (gp = guest_envp; gp; gp += sizeof(abi_ulong)) { if (get_user_ual(addr, gp)) goto efault; if (!addr) @@ -3268,7 +3268,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, argp = alloca((argc + 1) * sizeof(void *)); envp = alloca((envc + 1) * sizeof(void *)); - for (gp = guest_argp, q = argp; ; + for (gp = guest_argp, q = argp; gp; gp += sizeof(abi_ulong), q++) { if (get_user_ual(addr, gp)) goto execve_efault; @@ -3279,7 +3279,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, } *q = NULL; - for (gp = guest_envp, q = envp; ; + for (gp = guest_envp, q = envp; gp; gp += sizeof(abi_ulong), q++) { if (get_user_ual(addr, gp)) goto execve_efault; -- cgit v1.2.1