diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2011-07-19 09:26:56 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2011-07-19 09:26:56 +0000 |
commit | a8657c4b40c74416b1e2cd0ed85d114d0d99cd4b (patch) | |
tree | 493f7cee0ec7eaf97e5bc1b10e71cb4a8b3d30fd /Src | |
parent | 5c3c825e5fee76829b8f61020c3f0e72f9f6b316 (diff) | |
download | zsh-a8657c4b40c74416b1e2cd0ed85d114d0d99cd4b.tar.gz zsh-a8657c4b40c74416b1e2cd0ed85d114d0d99cd4b.tar.xz zsh-a8657c4b40c74416b1e2cd0ed85d114d0d99cd4b.zip |
29555: fix problem using open fd beyond max_zsh_fd
Diffstat (limited to 'Src')
-rw-r--r-- | Src/exec.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Src/exec.c b/Src/exec.c index 644a58367..f5b59a36e 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -3008,11 +3008,17 @@ execcmd(Estate state, int input, int output, int how, int last1) if (!checkclobberparam(fn)) fil = -1; else if (fn->fd2 > 9 && - (fn->fd2 > max_zsh_fd || - (fdtable[fn->fd2] != FDT_UNUSED && - fdtable[fn->fd2] != FDT_EXTERNAL) || - fn->fd2 == coprocin || - fn->fd2 == coprocout)) { + /* + * If the requested fd is > max_zsh_fd, + * the shell doesn't know about it. + * Just assume the user knows what they're + * doing. + */ + (fn->fd2 <= max_zsh_fd && + ((fdtable[fn->fd2] != FDT_UNUSED && + fdtable[fn->fd2] != FDT_EXTERNAL) || + fn->fd2 == coprocin || + fn->fd2 == coprocout))) { fil = -1; errno = EBADF; } else { |