* complete.c (insert_text): Fix buffer overflow.

This commit is contained in:
Andrew V. Samoilov 2002-03-25 07:28:25 +00:00
parent 6b6a850816
commit ac26b4f20e
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2002-03-25 Andrew V. Samoilov <kai@cmail.ru>
* complete.c (insert_text): Fix buffer overflow.
2002-03-21 Andrew V. Samoilov <kai@cmail.ru>
* man2hlp.c (handle_command): Handle backslash quoting

View File

@ -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;