aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 4fdd15900..89e06df4d 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -4226,6 +4226,14 @@ static char *fetch_till_str(o_string *as_string,
int prev = 0; /* not \ */
int ch;
+ /* Starting with "" is necessary for this case:
+ * cat <<EOF
+ *
+ * xxx
+ * EOF
+ */
+ heredoc.data = xzalloc(1); /* start as "", not as NULL */
+
goto jump_in;
while (1) {