diff options
author | 2005-08-01 07:02:39 +0000 | |
---|---|---|
committer | 2005-08-01 07:02:39 +0000 | |
commit | a792ab755265aabfcfab81fea14f742f005ae876 (patch) | |
tree | 730ccd0d4389c1960ac252fdc45fd0525efd0954 /sys/kern/exec_script.c | |
parent | sys_select() used to use 6 local fd_set's in case the width was <= the (diff) | |
download | wireguard-openbsd-a792ab755265aabfcfab81fea14f742f005ae876.tar.xz wireguard-openbsd-a792ab755265aabfcfab81fea14f742f005ae876.zip |
- We shouldn't allocate MAXPATHLEN from the stack.
- Don't copy the pathbuf into kernel space unless we're systracing.
deraadt@ ok
Diffstat (limited to 'sys/kern/exec_script.c')
-rw-r--r-- | sys/kern/exec_script.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c index ba6b99f0575..929982fa393 100644 --- a/sys/kern/exec_script.c +++ b/sys/kern/exec_script.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_script.c,v 1.21 2004/07/07 07:31:40 marius Exp $ */ +/* $OpenBSD: exec_script.c,v 1.22 2005/08/01 07:02:39 art Exp $ */ /* $NetBSD: exec_script.c,v 1.13 1996/02/04 02:15:06 christos Exp $ */ /* @@ -221,20 +221,21 @@ check_shell: #endif /* normally can't fail, but check for it if diagnostic */ #if NSYSTRACE > 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 + /* + * 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, + NULL); #else error = copyinstr(epp->ep_name, *tmpsap++, MAXPATHLEN, (size_t *)0); |