about summary refs log tree commit diff
diff options
context:
space:
mode:
-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;