about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2000-04-07 02:27:44 +0000
committerClint Adams <clint@users.sourceforge.net>2000-04-07 02:27:44 +0000
commit18870148c5e4e71c356821000bb2b8d07366cd49 (patch)
treedd1b70ae888b2b26aeca95ffc8854cbc4123abdf /Src
parentd2330ba0554b09a3f942a921acfbbabcf6466bef (diff)
downloadzsh-18870148c5e4e71c356821000bb2b8d07366cd49.tar.gz
zsh-18870148c5e4e71c356821000bb2b8d07366cd49.tar.xz
zsh-18870148c5e4e71c356821000bb2b8d07366cd49.zip
10564: typo in _wanted
10565: maximum function depth configure option
10566: patgetglobflags has a second argument now
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c13
-rw-r--r--Src/glob.c4
2 files changed, 16 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 0dffaf4e2..79dca611d 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3251,6 +3251,9 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
     char saveopts[OPT_SIZE], *oldscriptname = NULL, *fname = dupstring(name);
     int obreaks;
     struct funcstack fstack;
+#ifdef MAX_FUNCTION_DEPTH
+    static int funcdepth;
+#endif
 
     pushheap();
 
@@ -3300,6 +3303,13 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
 	    argzero = ztrdup(argzero);
 	}
     }
+#ifdef MAX_FUNCTION_DEPTH
+    if(++funcdepth > MAX_FUNCTION_DEPTH)
+    {
+        zerr("maximum nested function level reached", NULL, 0);
+	return;
+    }
+#endif
     fstack.name = dupstring(name);
     fstack.prev = funcstack;
     funcstack = &fstack;
@@ -3323,6 +3333,9 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval)
     }
     runshfunc(prog, wrappers, fstack.name);
     funcstack = fstack.prev;
+#ifdef MAX_FUNCTION_DEPTH
+    --funcdepth;
+#endif
     if (retflag) {
 	retflag = 0;
 	breaks = obreaks;
diff --git a/Src/glob.c b/Src/glob.c
index 663e0167f..623a50706 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -698,6 +698,8 @@ parsecomplist(char *instr)
 static Complist
 parsepat(char *str)
 {
+    long assert;
+
     patcompstart();
     /*
      * Check for initial globbing flags, so that they don't form
@@ -707,7 +709,7 @@ parsepat(char *str)
 	(isset(KSHGLOB) && *str == '@' && str[1] == Inpar &&
 	 str[2] == Pound)) {
 	str += (*str == Inpar) ? 2 : 3;
-	if (!patgetglobflags(&str))
+	if (!patgetglobflags(&str, &assert))
 	    return NULL;
     }