diff options
author | 2016-05-31 16:12:00 +0000 | |
---|---|---|
committer | 2016-05-31 16:12:00 +0000 | |
commit | ef07c437dfbcb57696263bd17a2872d02bb59ed5 (patch) | |
tree | b21bc89de09039ab7a3864dc5596b0a0005a3033 | |
parent | The argument of remove_history() only counts existing entries, (diff) | |
download | wireguard-openbsd-ef07c437dfbcb57696263bd17a2872d02bb59ed5.tar.xz wireguard-openbsd-ef07c437dfbcb57696263bd17a2872d02bb59ed5.zip |
Fix a crash in stifle_history() that occurred when the history
contained more than twice as many entries as the new limit: The
argument of remove_history() only counts existing elements, not
those previously deleted.
Crash found by bentley@ when exiting sqlite3(1).
-rw-r--r-- | lib/libedit/readline.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index 4eeb2208acf..af13ec54946 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readline.c,v 1.26 2016/05/10 11:07:53 schwarze Exp $ */ +/* $OpenBSD: readline.c,v 1.27 2016/05/31 16:12:00 schwarze Exp $ */ /* $NetBSD: readline.c,v 1.91 2010/08/28 15:44:59 christos Exp $ */ /*- @@ -1149,7 +1149,7 @@ stifle_history(int max) if (max < len) history_base += len - max; for (i = 0; i < len - max; i++) { - he = remove_history(i); + he = remove_history(0); free(he->data); free((void *)he->line); free(he); |