mirror of git://git.sv.gnu.org/nano.git
in display_string(), really avoid a memory corruption problem by
allocating enough space for COLS characters git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3021 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
a03d9c0ecd
commit
c4b854d5c7
|
@ -336,6 +336,8 @@ CVS code -
|
||||||
which can be possible if there are enough tabs and the
|
which can be possible if there are enough tabs and the
|
||||||
terminal size is sufficiently large, don't try to display it
|
terminal size is sufficiently large, don't try to display it
|
||||||
using control_mbrep(). (DLR, found by Duncan Geoffry Doyle)
|
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()
|
edit_redraw(), edit_refresh()
|
||||||
- Clean up and simplify. (DLR)
|
- Clean up and simplify. (DLR)
|
||||||
edit_update()
|
edit_update()
|
||||||
|
|
|
@ -2328,9 +2328,8 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||||
|
|
||||||
assert(column <= start_col);
|
assert(column <= start_col);
|
||||||
|
|
||||||
/* Allocate enough space for the entire line, accounting for a
|
/* Allocate enough space for the entire line. */
|
||||||
* trailing multibyte character and/or tab. */
|
alloc_len = (mb_cur_max() * COLS);
|
||||||
alloc_len = (mb_cur_max() * (len + 1)) + tabsize;
|
|
||||||
|
|
||||||
converted = charalloc(alloc_len + 1);
|
converted = charalloc(alloc_len + 1);
|
||||||
index = 0;
|
index = 0;
|
||||||
|
|
Loading…
Reference in New Issue