summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-02-05 19:28:16 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-02-05 19:28:16 +0000
commit4735ee67af6c121929ba8f0f604d3dcfb78dd089 (patch)
tree4e1547094b5caf2e7416778bb6f493a527ce86d4
parent368d303a20726a3027b887eef64b3f9920c450a2 (diff)
downloadzsh-4735ee67af6c121929ba8f0f604d3dcfb78dd089.tar.gz
zsh-4735ee67af6c121929ba8f0f604d3dcfb78dd089.zip
30127: forbid fc from executing history lines in reverse
-rw-r--r--ChangeLog7
-rw-r--r--Src/builtin.c6
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;