Dont write to the stackgap directly in execve().

This commit is contained in:
Peter Wemm 2003-11-07 21:27:13 +00:00
parent 5ed80e429e
commit 71d6084373

View File

@ -398,7 +398,7 @@ freebsd32_execve(struct thread *td, struct freebsd32_execve_args *uap)
caddr_t sg; caddr_t sg;
struct execve_args ap; struct execve_args ap;
u_int32_t *p32, arg; u_int32_t *p32, arg;
char **p; char **p, *p64;
int count; int count;
sg = stackgap_init(); sg = stackgap_init();
@ -421,7 +421,10 @@ freebsd32_execve(struct thread *td, struct freebsd32_execve_args *uap)
error = copyin(p32++, &arg, sizeof(arg)); error = copyin(p32++, &arg, sizeof(arg));
if (error) if (error)
return error; return error;
*p++ = PTRIN(arg); p64 = PTRIN(arg);
error = copyout(&p64, p++, sizeof(p64));
if (error)
return error;
} while (arg != 0); } while (arg != 0);
} }
if (uap->envv) { if (uap->envv) {
@ -440,7 +443,10 @@ freebsd32_execve(struct thread *td, struct freebsd32_execve_args *uap)
error = copyin(p32++, &arg, sizeof(arg)); error = copyin(p32++, &arg, sizeof(arg));
if (error) if (error)
return error; return error;
*p++ = PTRIN(arg); p64 = PTRIN(arg);
error = copyout(&p64, p++, sizeof(p64));
if (error)
return error;
} while (arg != 0); } while (arg != 0);
} }