mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-26 06:39:43 +03:00
really fix the memory corruption problem in display_string()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2239 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
9ac20c85b0
commit
6d594a9cbb
@ -2340,7 +2340,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
#endif
|
||||
}
|
||||
|
||||
while (index < alloc_len && buf[start_index] != '\0') {
|
||||
while (index < alloc_len - 1 && buf[start_index] != '\0') {
|
||||
int wide_buf, wide_buf_len;
|
||||
#ifdef NANO_WIDE
|
||||
bool bad_char;
|
||||
@ -2449,7 +2449,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
start_index += wide_buf_len;
|
||||
}
|
||||
|
||||
if (index < alloc_len)
|
||||
if (index < alloc_len - 1)
|
||||
converted[index] = '\0';
|
||||
|
||||
/* Make sure converted takes up no more than len columns. */
|
||||
|
Loading…
Reference in New Issue
Block a user