mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
* dash: update to version 0.5.12.
Removed old Gentoo patches (Debian has a bunch that might be worth adding, perhaps).
Removed spurious readline dependency.
Apparently, libedit could be used instead ("--with-libedit" option of ./configure),
but then it fails to compile. Easily fixed, but resulting binary still doesn't do proper
line editting at all.
Removed TEST() as "make check" doesn't do anything meaningful.
Smoke tested (on beta5 64 bits) by using it to "jam -q -j4 Terminal" on Haiku's source tree
(making sure dash was set as JAMSHELL, of course).
* dash: import some patches from Debian.
Got them from:
https://salsa.debian.org/debian/dash/-/tree/debian/unstable/debian/patches?ref_type=heads
52 lines
1.6 KiB
Diff
52 lines
1.6 KiB
Diff
From: Chris Lamb <lamby@debian.org>
|
|
Date: Thu, 15 Feb 2018 20:28:25 +0000
|
|
Subject: dash: Fix stack overflow from infinite recursion in script
|
|
|
|
Bug-Debian: https://bugs.debian.org/579815
|
|
Signed-off-by: Chris Lamb <lamby@debian.org>
|
|
Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
|
|
---
|
|
src/eval.c | 8 +++++++-
|
|
src/eval.h | 2 ++
|
|
2 files changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/eval.c b/src/eval.c
|
|
index fa43b68..fc291ba 100644
|
|
--- a/src/eval.c
|
|
+++ b/src/eval.c
|
|
@@ -71,6 +71,7 @@ int evalskip; /* set if we are skipping commands */
|
|
STATIC int skipcount; /* number of levels to skip */
|
|
MKINIT int loopnest; /* current loop nesting level */
|
|
static int funcline; /* starting line number of current function, or 0 if not in a function */
|
|
+static int evalcount; /* number of nested evalfun calls */
|
|
|
|
|
|
char *commandname;
|
|
@@ -914,7 +915,12 @@ raise:
|
|
break;
|
|
|
|
case CMDFUNCTION:
|
|
- if (evalfun(cmdentry.u.func, argc, argv, flags))
|
|
+ if (evalcount++ >= MAX_RECURSION)
|
|
+ sh_error("Maximum function recursion depth (%d) reached",
|
|
+ MAX_RECURSION);
|
|
+ int i = evalfun(cmdentry.u.func, argc, argv, flags);
|
|
+ evalcount--;
|
|
+ if (i)
|
|
goto raise;
|
|
break;
|
|
}
|
|
diff --git a/src/eval.h b/src/eval.h
|
|
index 63e7d86..38dffbd 100644
|
|
--- a/src/eval.h
|
|
+++ b/src/eval.h
|
|
@@ -51,6 +51,8 @@ struct backcmd { /* result of evalbackcmd */
|
|
#define EV_EXIT 01 /* exit after evaluating tree */
|
|
#define EV_TESTED 02 /* exit status is checked; ignore -e flag */
|
|
|
|
+#define MAX_RECURSION 1000 /* maximum recursion level */
|
|
+
|
|
int evalstring(char *, int);
|
|
union node; /* BLETCH for ansi C */
|
|
int evaltree(union node *, int);
|