diff options
author | 2004-07-07 07:31:40 +0000 | |
---|---|---|
committer | 2004-07-07 07:31:40 +0000 | |
commit | f5194861ac19d8129b33b767dd4d9549c5d94cc8 (patch) | |
tree | 8a307bfc754b5f93ffa310c9b9150534e64dccfa /sys/kern/exec_script.c | |
parent | Endian conversion mistakenly done before fraction math; ok henning@ (diff) | |
download | wireguard-openbsd-f5194861ac19d8129b33b767dd4d9549c5d94cc8.tar.xz wireguard-openbsd-f5194861ac19d8129b33b767dd4d9549c5d94cc8.zip |
fix an issue when scripts are exec'd under systrace where
the argv[0] would be normalized, and hence break scripts
that depend on how they were called.
this fixes an issue in the ports builds.
ok provos@ deraadt@; lots of testing during hackathon sturm@ naddy@
Diffstat (limited to 'sys/kern/exec_script.c')
-rw-r--r-- | sys/kern/exec_script.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c index e0af44c583d..ba6b99f0575 100644 --- a/sys/kern/exec_script.c +++ b/sys/kern/exec_script.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_script.c,v 1.20 2004/06/23 05:16:35 marius Exp $ */ +/* $OpenBSD: exec_script.c,v 1.21 2004/07/07 07:31:40 marius Exp $ */ /* $NetBSD: exec_script.c,v 1.13 1996/02/04 02:15:06 christos Exp $ */ /* @@ -221,11 +221,23 @@ check_shell: #endif /* normally can't fail, but check for it if diagnostic */ #if NSYSTRACE > 0 - error = copystr(epp->ep_name, *tmpsap++, MAXPATHLEN, - (size_t *)0); + error = 1; + if (ISSET(p->p_flag, P_SYSTRACE)) { + error = systrace_scriptname(p, *tmpsap); + if (error == 0) + tmpsap++; + } + if (error != 0) + /* + * Since systrace_scriptname() provides a + * convenience, not a security issue, we are + * safe to do this. + */ + error = copystr(epp->ep_name, *tmpsap++, + MAXPATHLEN, NULL); #else error = copyinstr(epp->ep_name, *tmpsap++, MAXPATHLEN, - (size_t *)0); + (size_t *)0); #endif #ifdef DIAGNOSTIC if (error != 0) |