aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-02-08 19:39:42 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-02-08 19:39:42 +0100
commitf786901c4bc2e724221e5c07208c3cd7913cb98c (patch)
treedddfb251d33f3a37eb2ac520e93a15b1bf99ba73
parent5807e18f0c4f6fc247103830affcab73ca1ffa37 (diff)
downloadbusybox-w32-f786901c4bc2e724221e5c07208c3cd7913cb98c.tar.gz
busybox-w32-f786901c4bc2e724221e5c07208c3cd7913cb98c.tar.bz2
busybox-w32-f786901c4bc2e724221e5c07208c3cd7913cb98c.zip
hush: probably fixing a bug in last LINENO fix
I don't have an example of mishandled script, but the logic looked wrong: it could sometimes treat newlines as if they are spaces. function old new delta parse_stream 2788 2787 -1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/hush.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/shell/hush.c b/shell/hush.c
index f2ffcf54d..8f1017e3c 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -5019,18 +5019,13 @@ static struct pipe *parse_stream(char **pstring,
5019 * i.e., at the previous line. 5019 * i.e., at the previous line.
5020 * We need to skip all whitespace before newlines. 5020 * We need to skip all whitespace before newlines.
5021 */ 5021 */
5022 if (ch != '\n') { 5022 while (ch != '\n') {
5023 /* It was whitespace, but not a newline. 5023 next = i_peek(input);
5024 * Eat all whitespace. 5024 if (next != ' ' && next != '\t' && next != '\n')
5025 */ 5025 break; /* next char is not ws */
5026 for (;;) { 5026 ch = i_getch(input);
5027 next = i_peek(input);
5028 if (next != ' ' && next != '\t' && next != '\n')
5029 break; /* next char is not ws */
5030 ch = i_getch(input);
5031 }
5032 /* ch == last eaten whitespace char */
5033 } 5027 }
5028 /* ch == last eaten whitespace char */
5034#endif 5029#endif
5035 if (done_word(&dest, &ctx)) { 5030 if (done_word(&dest, &ctx)) {
5036 goto parse_error; 5031 goto parse_error;