From e9fc15847232732da87ef32cee7893d0b2c0b244 Mon Sep 17 00:00:00 2001 From: tg Date: Wed, 24 Feb 2016 01:45:59 +0000 Subject: [PATCH] =?UTF-8?q?plug=20a=20buffer=20underflow=20read=20we=20exe?= =?UTF-8?q?cuted=20with=20*every*=20testsuite=20run=20and=20*every*=20inte?= =?UTF-8?q?ractive=20shell=20session=20(history=20didn=E2=80=99t=20contain?= =?UTF-8?q?=20anything=20when=20we=20tested=20for=20ignoredups)=E2=80=A6?= =?UTF-8?q?=20first=20caught=20by=20the=20new=20code=E2=80=A6=20d=E2=80=99?= =?UTF-8?q?uuuuuuuuuuh!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- histrap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/histrap.c b/histrap.c index 4c16fb8..5932ea3 100644 --- a/histrap.c +++ b/histrap.c @@ -27,7 +27,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.153 2016/01/21 18:24:40 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.154 2016/02/24 01:45:59 tg Exp $"); Trap sigtraps[ksh_NSIG + 1]; static struct sigaction Sigact_ign; @@ -658,7 +658,9 @@ histsave(int *lnp, const char *cmd, int svmode, bool ignoredups) strndupx(c, cmd, ccp - cmd, APERM); if (svmode != HIST_APPEND) { - if (ignoredups && !strcmp(c, *histptr) + if (ignoredups && + histptr >= history && + !strcmp(c, *histptr) #if !defined(MKSH_SMALL) && HAVE_PERSISTENT_HISTORY && !histsync() #endif