about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-10-22 15:14:41 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-10-22 15:14:41 +0000
commit4b76c491c942f655e7cf013fa63febbd751a1c08 (patch)
tree12cacf4825142856466566b688de28b22cd4166a
parentf7c8c983894770f75180e2faf5268cc9f54753fc (diff)
downloadzsh-4b76c491c942f655e7cf013fa63febbd751a1c08.tar.gz
zsh-4b76c491c942f655e7cf013fa63febbd751a1c08.tar.xz
zsh-4b76c491c942f655e7cf013fa63febbd751a1c08.zip
Fix fdtable_size crash.
-rw-r--r--ChangeLog5
-rw-r--r--Src/init.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b4bb97ed..33db57d28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-22  Bart Schaefer  <schaefer@zsh.org>
+
+	* 16109: Use a fixed initial fdtable_size to fix crash resulting
+	from a huge memory allocation, as reported in 16082.
+
 2001-10-20  Bart Schaefer  <schaefer@zsh.org>
 
 	* Adapted from Stefan Dalibor, 16043: Src/utils.c: checkrmall()
diff --git a/Src/init.c b/Src/init.c
index f343f3025..ffe873e4f 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1190,7 +1190,8 @@ zsh_main(int argc, char **argv)
 	  break;
     } while (zsh_name);
 
-    fdtable_size = zopenmax();
+    /* Not zopenmax() here: it may return a number too big for zcalloc(). */
+    fdtable_size = 256; /* This grows as necessary, see utils.c:movefd(). */
     fdtable = zcalloc(fdtable_size);
 
     createoptiontable();