vim-patch:8.1.2018: using freed memory when out of memory and displaying message

Problem:    Using freed memory when out of memory and displaying message.
Solution:   Make a copy of the message first.
e5fbd73930
This commit is contained in:
Jan Edmund Lazo
2020-05-31 17:01:28 -04:00
parent 310a56d0a0
commit 44531928b3
3 changed files with 12 additions and 10 deletions

View File

@@ -306,11 +306,6 @@ bool msg_attr_keep(char_u *s, int attr, bool keep, bool multiline)
add_msg_hist((const char *)s, -1, attr, multiline);
}
/* When displaying keep_msg, don't let msg_start() free it, caller must do
* that. */
if (s == keep_msg)
keep_msg = NULL;
/* Truncate the message if needed. */
msg_start();
buf = msg_strtrunc(s, FALSE);