|
|
ff19ae |
--- ../bash-4.2-orig/parse.y 2014-09-25 13:07:59.218209276 +0200
|
|
|
ff19ae |
+++ parse.y 2014-09-25 15:26:52.813159810 +0200
|
|
|
ff19ae |
@@ -264,9 +264,21 @@
|
|
|
ff19ae |
|
|
|
ff19ae |
/* Variables to manage the task of reading here documents, because we need to
|
|
|
ff19ae |
defer the reading until after a complete command has been collected. */
|
|
|
ff19ae |
-static REDIRECT *redir_stack[10];
|
|
|
ff19ae |
+static REDIRECT **redir_stack;
|
|
|
ff19ae |
int need_here_doc;
|
|
|
ff19ae |
|
|
|
ff19ae |
+/* Pushes REDIR onto redir_stack, resizing it as needed. */
|
|
|
ff19ae |
+static void
|
|
|
ff19ae |
+push_redir_stack (REDIRECT *redir)
|
|
|
ff19ae |
+{
|
|
|
ff19ae |
+ /* Guard against oveflow. */
|
|
|
ff19ae |
+ if (need_here_doc + 1 > INT_MAX / sizeof (*redir_stack))
|
|
|
ff19ae |
+ abort ();
|
|
|
ff19ae |
+ redir_stack = xrealloc (redir_stack,
|
|
|
ff19ae |
+ (need_here_doc + 1) * sizeof (*redir_stack));
|
|
|
ff19ae |
+ redir_stack[need_here_doc++] = redir;
|
|
|
ff19ae |
+}
|
|
|
ff19ae |
+
|
|
|
ff19ae |
/* Where shell input comes from. History expansion is performed on each
|
|
|
ff19ae |
line when the shell is interactive. */
|
|
|
ff19ae |
static char *shell_input_line = (char *)NULL;
|
|
|
ff19ae |
@@ -519,42 +531,42 @@
|
|
|
ff19ae |
source.dest = 0;
|
|
|
ff19ae |
redir.filename = $2;
|
|
|
ff19ae |
$$ = make_redirection (source, r_reading_until, redir, 0);
|
|
|
ff19ae |
- redir_stack[need_here_doc++] = $$;
|
|
|
ff19ae |
+ push_redir_stack ($$);
|
|
|
ff19ae |
}
|
|
|
ff19ae |
| NUMBER LESS_LESS WORD
|
|
|
ff19ae |
{
|
|
|
ff19ae |
source.dest = $1;
|
|
|
ff19ae |
redir.filename = $3;
|
|
|
ff19ae |
$$ = make_redirection (source, r_reading_until, redir, 0);
|
|
|
ff19ae |
- redir_stack[need_here_doc++] = $$;
|
|
|
ff19ae |
+ push_redir_stack ($$);
|
|
|
ff19ae |
}
|
|
|
ff19ae |
| REDIR_WORD LESS_LESS WORD
|
|
|
ff19ae |
{
|
|
|
ff19ae |
source.filename = $1;
|
|
|
ff19ae |
redir.filename = $3;
|
|
|
ff19ae |
$$ = make_redirection (source, r_reading_until, redir, REDIR_VARASSIGN);
|
|
|
ff19ae |
- redir_stack[need_here_doc++] = $$;
|
|
|
ff19ae |
+ push_redir_stack ($$);
|
|
|
ff19ae |
}
|
|
|
ff19ae |
| LESS_LESS_MINUS WORD
|
|
|
ff19ae |
{
|
|
|
ff19ae |
source.dest = 0;
|
|
|
ff19ae |
redir.filename = $2;
|
|
|
ff19ae |
$$ = make_redirection (source, r_deblank_reading_until, redir, 0);
|
|
|
ff19ae |
- redir_stack[need_here_doc++] = $$;
|
|
|
ff19ae |
+ push_redir_stack ($$);
|
|
|
ff19ae |
}
|
|
|
ff19ae |
| NUMBER LESS_LESS_MINUS WORD
|
|
|
ff19ae |
{
|
|
|
ff19ae |
source.dest = $1;
|
|
|
ff19ae |
redir.filename = $3;
|
|
|
ff19ae |
$$ = make_redirection (source, r_deblank_reading_until, redir, 0);
|
|
|
ff19ae |
- redir_stack[need_here_doc++] = $$;
|
|
|
ff19ae |
+ push_redir_stack ($$);
|
|
|
ff19ae |
}
|
|
|
ff19ae |
| REDIR_WORD LESS_LESS_MINUS WORD
|
|
|
ff19ae |
{
|
|
|
ff19ae |
source.filename = $1;
|
|
|
ff19ae |
redir.filename = $3;
|
|
|
ff19ae |
$$ = make_redirection (source, r_deblank_reading_until, redir, REDIR_VARASSIGN);
|
|
|
ff19ae |
- redir_stack[need_here_doc++] = $$;
|
|
|
ff19ae |
+ push_redir_stack ($$);
|
|
|
ff19ae |
}
|
|
|
ff19ae |
| LESS_LESS_LESS WORD
|
|
|
ff19ae |
{
|
|
|
ff19ae |
@@ -4757,7 +4769,7 @@
|
|
|
ff19ae |
case CASE:
|
|
|
ff19ae |
case SELECT:
|
|
|
ff19ae |
case FOR:
|
|
|
ff19ae |
- if (word_top < MAX_CASE_NEST)
|
|
|
ff19ae |
+ if (word_top + 1 < MAX_CASE_NEST)
|
|
|
ff19ae |
word_top++;
|
|
|
ff19ae |
word_lineno[word_top] = line_number;
|
|
|
ff19ae |
break;
|