From 18870148c5e4e71c356821000bb2b8d07366cd49 Mon Sep 17 00:00:00 2001 From: Clint Adams Date: Fri, 7 Apr 2000 02:27:44 +0000 Subject: 10564: typo in _wanted 10565: maximum function depth configure option 10566: patgetglobflags has a second argument now --- Src/exec.c | 13 +++++++++++++ Src/glob.c | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'Src') 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; } -- cgit 1.4.1