diff options
author | dg <dg@FreeBSD.org> | 1995-03-01 04:09:50 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-03-01 04:09:50 +0000 |
commit | e9d6feff91f1559865ec282f9152b680d7d962a3 (patch) | |
tree | 6398ea725d0c29f6044a0c8a8f0347977c217da9 | |
parent | 1713f4a4248fa6e3f0fdafd122ab6b7ff04c6849 (diff) | |
download | FreeBSD-src-e9d6feff91f1559865ec282f9152b680d7d962a3.zip FreeBSD-src-e9d6feff91f1559865ec282f9152b680d7d962a3.tar.gz |
No longer assume that a process's address space can be directly written to.
-rw-r--r-- | sys/kern/kern_exec.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index e77db82..440fc5c 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_exec.c,v 1.12 1995/02/14 19:22:28 sos Exp $ + * $Id: kern_exec.c,v 1.13 1995/02/20 22:23:11 davidg Exp $ */ #include <sys/param.h> @@ -223,7 +223,7 @@ interpret: if (p->p_sysent->sv_fixup) (*p->p_sysent->sv_fixup)(&stack_base, iparams); else - *(--stack_base) = iparams->argc; + suword(--stack_base, iparams->argc); /* close files on exec */ fdcloseexec(p); @@ -469,35 +469,44 @@ exec_copyout_strings(iparams) envc = iparams->envc; /* + * Copy out strings - arguments and environment. + */ + copyout(stringp, destp, ARG_MAX - iparams->stringspace); + + /* * Fill in "ps_strings" struct for ps, w, etc. */ - arginfo->ps_argvstr = destp; - arginfo->ps_nargvstr = argc; + suword(&arginfo->ps_argvstr, (int)destp); + suword(&arginfo->ps_nargvstr, argc); /* - * Copy the arg strings and fill in vector table as we go. + * Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - *(vectp++) = destp; - while ((*destp++ = *stringp++)); + suword(vectp++, (int)destp); + while (*stringp++ != 0) + destp++; + destp++; } /* a null vector table pointer seperates the argp's from the envp's */ - *(vectp++) = NULL; + suword(vectp++, NULL); - arginfo->ps_envstr = destp; - arginfo->ps_nenvstr = envc; + suword(&arginfo->ps_envstr, (int)destp); + suword(&arginfo->ps_nenvstr, envc); /* - * Copy the env strings and fill in vector table as we go. + * Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - *(vectp++) = destp; - while ((*destp++ = *stringp++)); + suword(vectp++, (int)destp); + while (*stringp++ != 0) + destp++; + destp++; } /* end of vector table is a null pointer */ - *vectp = NULL; + suword(vectp, NULL); return (stack_base); } |