aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-07-23 15:43:57 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-07-23 15:43:57 +0200
commitd73cdbf84c9c7d509baf69eb3256dcaf733f4d93 (patch)
tree676c221aa69cf5922890993baccc9c9040d7f4d8 /shell/hush.c
parentca2f831ead327d98ab3374acb3b07ad7632ea02d (diff)
downloadbusybox-w32-d73cdbf84c9c7d509baf69eb3256dcaf733f4d93.tar.gz
busybox-w32-d73cdbf84c9c7d509baf69eb3256dcaf733f4d93.tar.bz2
busybox-w32-d73cdbf84c9c7d509baf69eb3256dcaf733f4d93.zip
hush: fix handling of heredocs starting with empty lines
function old new delta parse_stream 2748 2759 +11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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,
4226 int prev = 0; /* not \ */ 4226 int prev = 0; /* not \ */
4227 int ch; 4227 int ch;
4228 4228
4229 /* Starting with "" is necessary for this case:
4230 * cat <<EOF
4231 *
4232 * xxx
4233 * EOF
4234 */
4235 heredoc.data = xzalloc(1); /* start as "", not as NULL */
4236
4229 goto jump_in; 4237 goto jump_in;
4230 4238
4231 while (1) { 4239 while (1) {