diff --git a/ChangeLog b/ChangeLog index 982f91ba032289c9f54d5e041e72111672eeb7b3..f47a0c90eb5c0e054a47239e52f7f053effe9158 100644 --- a/ChangeLog +++ b/ChangeLog @@ -336,6 +336,8 @@ CVS code - which can be possible if there are enough tabs and the terminal size is sufficiently large, don't try to display it using control_mbrep(). (DLR, found by Duncan Geoffry Doyle) + - Really avoid a memory corruption problem by allocating enough + space for COLS characters. (DLR) edit_redraw(), edit_refresh() - Clean up and simplify. (DLR) edit_update() diff --git a/src/winio.c b/src/winio.c index 17ca14bf7864f92998686de4e89a1f59bb4b4eef..30789484c55584dc7defed27dd51742ee3bc096a 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2328,9 +2328,8 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool assert(column <= start_col); - /* Allocate enough space for the entire line, accounting for a - * trailing multibyte character and/or tab. */ - alloc_len = (mb_cur_max() * (len + 1)) + tabsize; + /* Allocate enough space for the entire line. */ + alloc_len = (mb_cur_max() * COLS); converted = charalloc(alloc_len + 1); index = 0;