aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authorMichal Zalewski <lcamtuf@coredump.cx>2014-10-10 11:16:06 +0100
committerPaul Kocialkowski <contact@paulk.fr>2014-11-16 11:43:09 +0100
commit80df778bb8f868423dfe5fc9847238eee8d0a764 (patch)
tree59d45ed476618e369899aaf1252f5ffcbb4df87e /parse.y
parent2190a70e6324494accf7747d2aa9f5e8702d875c (diff)
downloadexternal_bash-80df778bb8f868423dfe5fc9847238eee8d0a764.zip
external_bash-80df778bb8f868423dfe5fc9847238eee8d0a764.tar.gz
external_bash-80df778bb8f868423dfe5fc9847238eee8d0a764.tar.bz2
bugfix: bash executing code following func defHEADreplicant-4.2-0004replicant-4.2-0003replicant-4.2
This is an upstream bugfix (with slight alterations): Patch-ID: bash42-053 A combination of nested command substitutions and function importing from the environment can cause bash to execute code appearing in the environment variable value following the function definition. Change-Id: I660e59c76d0d50de52d48a0d399fe1dfef3bded8
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y14
1 files changed, 12 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index b3c17bc..b4ef178 100644
--- a/parse.y
+++ b/parse.y
@@ -2433,6 +2433,16 @@ shell_ungetc (c)
eol_ungetc_lookahead = c;
}
+char *
+parser_remaining_input ()
+{
+ if (shell_input_line == 0)
+ return 0;
+ if (shell_input_line_index < 0 || shell_input_line_index >= shell_input_line_len)
+ return '\0'; /* XXX */
+ return (shell_input_line + shell_input_line_index);
+}
+
#ifdef INCLUDE_UNUSED
/* Back the input pointer up by one, effectively `ungetting' a character. */
static void
@@ -3883,8 +3893,8 @@ xparse_dolparen (base, string, indp, flags)
restore_parser_state (&ps);
reset_parser ();
- if (interactive)
- token_to_read = 0;
+
+ token_to_read = 0;
/* Need to find how many characters parse_and_execute consumed, update
*indp, if flags != 0, copy the portion of the string parsed into RET