about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-05-02 12:32:41 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-05-02 12:32:41 +0000
commit17e3f742f15313d7f44537f03bf85cf6e6ed4216 (patch)
tree0ff65184020e736dab2416c862fc886b8ced3f36 /Src/exec.c
parentf16ab40c0632cd388180eecf91d414d257e85113 (diff)
downloadzsh-17e3f742f15313d7f44537f03bf85cf6e6ed4216.tar.gz
zsh-17e3f742f15313d7f44537f03bf85cf6e6ed4216.tar.xz
zsh-17e3f742f15313d7f44537f03bf85cf6e6ed4216.zip
29129: reading of end of fd array
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 9c72c68af..a06f2f3ac 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3008,10 +3008,11 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		if (!checkclobberparam(fn))
 		    fil = -1;
 		else if (fn->fd2 > 9 &&
-		    ((fdtable[fn->fd2] != FDT_UNUSED &&
-		      fdtable[fn->fd2] != FDT_EXTERNAL) ||
-		     fn->fd2 == coprocin ||
-		     fn->fd2 == coprocout)) {
+			 (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 {