From 663c6e794abd0a5b7972930bdfb26a178b5826fd Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 22 Feb 2002 20:40:29 +0000 Subject: In putoldhistentryontop(), ensure that we can't return with "next" set to the value we just put on top. --- Src/hist.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Src/hist.c b/Src/hist.c index 5c8ac8d95..492c876ec 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -924,14 +924,15 @@ putoldhistentryontop(short keep_going) if (!keep_going) max_unique_ct = getiparam("SAVEHIST"); do { - if (max_unique_ct-- <= 0) { + if (max_unique_ct-- <= 0 || he == hist_ring) { max_unique_ct = 0; he = hist_ring->down; + next = hist_ring; break; } he = next; next = he->down; - } while (he != hist_ring->down && !(he->flags & HIST_DUP)); + } while (!(he->flags & HIST_DUP)); } if (he != hist_ring->down) { he->up->down = he->down; -- cgit 1.4.1