From 4735ee67af6c121929ba8f0f604d3dcfb78dd089 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 5 Feb 2012 19:28:16 +0000 Subject: 30127: forbid fc from executing history lines in reverse --- Src/builtin.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Src/builtin.c') 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; -- cgit 1.4.1