From 513cf73b4f1df41ea16588797a3ee1dfa8229f8e Mon Sep 17 00:00:00 2001 From: david Date: Mon, 7 Jun 2004 05:58:45 +0000 Subject: [PATCH] don't go out of bounds in update_line(); found with malloc.conf; ok sturm@ --- net/icb/patches/patch-readline_readline_c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/net/icb/patches/patch-readline_readline_c b/net/icb/patches/patch-readline_readline_c index d06b2c4a0fc..50d7860b742 100644 --- a/net/icb/patches/patch-readline_readline_c +++ b/net/icb/patches/patch-readline_readline_c @@ -1,6 +1,6 @@ -$OpenBSD: patch-readline_readline_c,v 1.1 2001/05/14 16:42:54 millert Exp $ ---- readline/readline.c.orig Fri Feb 24 14:20:03 1995 -+++ readline/readline.c Mon May 14 10:33:03 2001 +$OpenBSD: patch-readline_readline_c,v 1.2 2004/06/07 05:58:45 david Exp $ +--- readline/readline.c.orig 1995-02-24 15:20:03.000000000 -0600 ++++ readline/readline.c 2004-06-06 22:06:07.000000000 -0500 @@ -610,22 +610,22 @@ rl_signal_handler (sig) rl_set_signals () @@ -63,3 +63,20 @@ $OpenBSD: patch-readline_readline_c,v 1.1 2001/05/14 16:42:54 millert Exp $ #endif } #endif /* HANDLE_SIGNALS */ +@@ -1700,8 +1700,14 @@ update_line (old, new, current_line) + return; + + wsatend = 1; /* flag for trailing whitespace */ +- ols = oe - 1; /* find last same */ +- nls = ne - 1; ++ ++ /* find last same */ ++ ols = oe; ++ if (oe != old) ++ ols--; ++ nls = ne; ++ if (ne != new) ++ nls--; + while ((*ols == *nls) && (ols > ofd) && (nls > nfd)) + { + if (*ols != ' ')