diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2012-02-05 19:28:16 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2012-02-05 19:28:16 +0000 |
commit | 4735ee67af6c121929ba8f0f604d3dcfb78dd089 (patch) | |
tree | 4e1547094b5caf2e7416778bb6f493a527ce86d4 | |
parent | 368d303a20726a3027b887eef64b3f9920c450a2 (diff) | |
download | zsh-4735ee67af6c121929ba8f0f604d3dcfb78dd089.tar.gz zsh-4735ee67af6c121929ba8f0f604d3dcfb78dd089.tar.xz zsh-4735ee67af6c121929ba8f0f604d3dcfb78dd089.zip |
30127: forbid fc from executing history lines in reverse
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Src/builtin.c | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 64b597e0b..cb49dc0c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-02-05 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 30127: Src/builtin.c: forbid executing history lines via fc in + the wrong order. + 2012-02-03 Peter Stephenson <pws@csr.com> * Mariusz Glebocki: 30179: Completion/Unix/Type/_services: @@ -15908,5 +15913,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5572 $ +* $Revision: 1.5573 $ ***************************************************** diff --git a/Src/builtin.c b/Src/builtin.c index 71fc04ce1..b43c08235 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -1652,6 +1652,12 @@ fclist(FILE *f, Options ops, zlong first, zlong last, last = first; first = tmp; } + if (first > last) { + zwarnnam("fc", "history events are in wrong order, aborted"); + if (f != stdout) + fclose(f); + return 1; + } /* suppress "no substitution" warning if no substitution is requested */ if (!subs) fclistdone = 1; |