vim-patch:8.2.2515: memory access error when truncating an empty message

Problem:    Memory access error when truncating an empty message.
Solution:   Check for an empty string. (Dominique Pellé, closes vim/vim#7841)
6281815ecc
This commit is contained in:
zeertzjq 2022-03-30 21:37:51 +08:00
parent 47630743fc
commit e2247c0baa

View File

@ -382,6 +382,13 @@ void trunc_string(char_u *s, char_u *buf, int room_in, int buflen)
int i;
int n;
if (*s == NUL) {
if (buflen > 0) {
*buf = NUL;
}
return;
}
if (room_in < 3) {
room = 0;
}