From ac26b4f20e211cf418cc5181b01d9313b49e618e Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Mon, 25 Mar 2002 07:28:25 +0000 Subject: [PATCH] * complete.c (insert_text): Fix buffer overflow. --- src/ChangeLog | 4 ++++ src/complete.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index a33b733a1..1939e59c1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2002-03-25 Andrew V. Samoilov + + * complete.c (insert_text): Fix buffer overflow. + 2002-03-21 Andrew V. Samoilov * man2hlp.c (handle_command): Handle backslash quoting diff --git a/src/complete.c b/src/complete.c index d53862d78..382773b6c 100644 --- a/src/complete.c +++ b/src/complete.c @@ -797,8 +797,8 @@ static int insert_text (WInput *in, char *text, int len) } if (strlen (in->buffer)+1 < in->current_max_len){ if (len > 0){ - int i, l = strlen (&in->buffer [end]); - for (i = l + 1; i >= 0; i--) + int i = strlen (&in->buffer [end]); + for (; i >= 0; i--) in->buffer [end + len + i] = in->buffer [end + i]; } else if (len < 0){ char *p = in->buffer + end + len, *q = in->buffer + end;