Commit da94d26390b292f2b9d90aee2936d8545364d5a2

Authored by pbrook
1 parent f0cbb613

Handle NULL argp/envp in execve syscall.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4627 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 4 deletions
linux-user/syscall.c
... ... @@ -3248,7 +3248,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
3248 3248  
3249 3249 argc = 0;
3250 3250 guest_argp = arg2;
3251   - for (gp = guest_argp; ; gp += sizeof(abi_ulong)) {
  3251 + for (gp = guest_argp; gp; gp += sizeof(abi_ulong)) {
3252 3252 if (get_user_ual(addr, gp))
3253 3253 goto efault;
3254 3254 if (!addr)
... ... @@ -3257,7 +3257,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
3257 3257 }
3258 3258 envc = 0;
3259 3259 guest_envp = arg3;
3260   - for (gp = guest_envp; ; gp += sizeof(abi_ulong)) {
  3260 + for (gp = guest_envp; gp; gp += sizeof(abi_ulong)) {
3261 3261 if (get_user_ual(addr, gp))
3262 3262 goto efault;
3263 3263 if (!addr)
... ... @@ -3268,7 +3268,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
3268 3268 argp = alloca((argc + 1) * sizeof(void *));
3269 3269 envp = alloca((envc + 1) * sizeof(void *));
3270 3270  
3271   - for (gp = guest_argp, q = argp; ;
  3271 + for (gp = guest_argp, q = argp; gp;
3272 3272 gp += sizeof(abi_ulong), q++) {
3273 3273 if (get_user_ual(addr, gp))
3274 3274 goto execve_efault;
... ... @@ -3279,7 +3279,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
3279 3279 }
3280 3280 *q = NULL;
3281 3281  
3282   - for (gp = guest_envp, q = envp; ;
  3282 + for (gp = guest_envp, q = envp; gp;
3283 3283 gp += sizeof(abi_ulong), q++) {
3284 3284 if (get_user_ual(addr, gp))
3285 3285 goto execve_efault;
... ...