diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2004-10-02 21:44:13 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2004-10-02 21:44:13 +0000 |
commit | 684da738b06f27d2736d6f60429f26206dc2ffbc (patch) | |
tree | 76d95bb39fc2e78815b2fd43720d77cd32183429 | |
parent | f986922ac262e10135132cb0b258cc834b3e6877 (diff) | |
download | zsh-684da738b06f27d2736d6f60429f26206dc2ffbc.tar.gz zsh-684da738b06f27d2736d6f60429f26206dc2ffbc.tar.xz zsh-684da738b06f27d2736d6f60429f26206dc2ffbc.zip |
20418: report parse error rather than crash on unfinished pipelines.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/parse.c | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index fdf08f3a9..59b34afbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -35,6 +35,11 @@ * 20358: Completion/Unix/Command/_make: avoid potential gawk locale bug by not using awk. +2004-09-29 Bart Schaefer <schaefer@zsh.org> + + * 20418: Src/parse.c: fix crash-inducing bug with mis-parsing of + incomplete pipeline expressions (e.g. "zsh -c 'echo |'). + 2004-09-28 Clint Adams <clint@zsh.org> * 20414: Completion/Unix/Type/_diff_options: correct missing diff --git a/Src/parse.c b/Src/parse.c index 551573f5a..d0f108333 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -729,7 +729,9 @@ par_pline(int *complex) ecbuf[p] = WCB_PIPE(WC_PIPE_MID, (line >= 0 ? line + 1 : 0)); ecispace(p + 1, 1); ecbuf[p + 1] = ecused - 1 - p; - par_pline(complex); + if (!par_pline(complex)) { + tok = LEXERR; + } cmdpop(); return 1; } else if (tok == BARAMP) { @@ -750,7 +752,9 @@ par_pline(int *complex) ecbuf[p] = WCB_PIPE(WC_PIPE_MID, (line >= 0 ? line + 1 : 0)); ecispace(p + 1, 1); ecbuf[p + 1] = ecused - 1 - p; - par_pline(complex); + if (!par_pline(complex)) { + tok = LEXERR; + } cmdpop(); return 1; } else { |