diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-06-17 11:11:14 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-06-17 11:11:14 +0000 |
commit | 38db754b25174070ed136b30600e0bcc16dc5822 (patch) | |
tree | 6ede5e261dc3fa5116b6facb5742431e45bd2dea /sys/compat/ibcs2/ibcs2_misc.c | |
parent | 756200b35a82da5cf261e44482d92c2054bd2f30 (diff) |
careful with stackgap handling in execve()
Diffstat (limited to 'sys/compat/ibcs2/ibcs2_misc.c')
-rw-r--r-- | sys/compat/ibcs2/ibcs2_misc.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/sys/compat/ibcs2/ibcs2_misc.c b/sys/compat/ibcs2/ibcs2_misc.c index d24bd0df34a..59bcee1414b 100644 --- a/sys/compat/ibcs2/ibcs2_misc.c +++ b/sys/compat/ibcs2/ibcs2_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ibcs2_misc.c,v 1.8 1997/01/23 16:12:18 niklas Exp $ */ +/* $OpenBSD: ibcs2_misc.c,v 1.9 1997/06/17 11:11:09 deraadt Exp $ */ /* $NetBSD: ibcs2_misc.c,v 1.23 1997/01/15 01:37:49 perry Exp $ */ /* @@ -200,14 +200,17 @@ ibcs2_sys_execv(p, v, retval) syscallarg(char *) path; syscallarg(char **) argp; } */ *uap = v; - struct sys_execve_args ea; - caddr_t sg = stackgap_init(p->p_emul); + struct sys_execve_args ap; + caddr_t sg; + sg = stackgap_init(p->p_emul); IBCS2_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - SCARG(&ea, path) = SCARG(uap, path); - SCARG(&ea, argp) = SCARG(uap, argp); - SCARG(&ea, envp) = NULL; - return sys_execve(p, &ea, retval); + + SCARG(&ap, path) = SCARG(uap, path); + SCARG(&ap, argp) = SCARG(uap, argp); + SCARG(&ap, envp) = NULL; + + return sys_execve(p, &ap, retval); } int @@ -216,15 +219,22 @@ ibcs2_sys_execve(p, v, retval) void *v; register_t *retval; { - struct sys_execve_args /* { + struct ibcs2_sys_execve_args /* { syscallarg(char *) path; - syscallarg(char **) argp; + syscallarg(char **) argv; syscallarg(char **) envp; - } */ *uap = v; - caddr_t sg = stackgap_init(p->p_emul); + } */ *uap = v; + struct sys_execve_args ap; + caddr_t sg; - IBCS2_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - return sys_execve(p, uap, retval); + sg = stackgap_init(p->p_emul); + IBCS2_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); + + SCARG(&ap, path) = SCARG(uap, path); + SCARG(&ap, argp) = SCARG(uap, argp); + SCARG(&ap, envp) = SCARG(uap, envp); + + return sys_execve(p, &ap, retval); } int |