valgrind
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2598
35c25a1d-7b9e-4130-9fde-
d3aeb78583b8
do_statusbar_output()
- Don't set answer_len until after it's been asserted that
answer isn't NULL. (DLR)
+ display_string()
+ - Avoid a memory corruption problem by allocating enough space
+ for len plus a trailing multibyte character and/or tab. (DLR)
nanogetstr()
- Rename variable def to curranswer to avoid confusion. (DLR)
- Only declare and use the tabbed variable if DISABLE_TABCOMP
assert(column <= start_col);
- /* Allocate enough space for the entire line. It should contain
- * (len + 2) multibyte characters at most. */
- alloc_len = mb_cur_max() * (len + 2);
+ /* Allocate enough space for the entire line, accounting for a
+ * trailing multibyte character and/or tab. */
+ alloc_len = (mb_cur_max() * (len + 1)) + tabsize;
converted = charalloc(alloc_len + 1);
index = 0;