mirror of
https://github.com/neovim/neovim.git
synced 2026-07-11 20:09:44 +00:00
vim-patch:8.2.5161: might still access invalid memory
Problem: Might still access invalid memory.
Solution: Add extra check for negative value.
0fbc9260a7
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -1052,8 +1052,11 @@ char *msg_may_trunc(bool force, char *s)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If something unexpected happened "room" may be negative, check for that
|
||||||
|
// just in case.
|
||||||
int room = (Rows - cmdline_row - 1) * Columns + sc_col - 1;
|
int room = (Rows - cmdline_row - 1) * Columns + sc_col - 1;
|
||||||
if ((force || (shortmess(SHM_TRUNC) && !exmode_active))
|
if (room > 0
|
||||||
|
&& (force || (shortmess(SHM_TRUNC) && !exmode_active))
|
||||||
&& (int)strlen(s) - room > 0) {
|
&& (int)strlen(s) - room > 0) {
|
||||||
int size = vim_strsize(s);
|
int size = vim_strsize(s);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user