mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.5161: might still access invalid memory
Problem: Might still access invalid memory. Solution: Add extra check for negative value.
This commit is contained in:
parent
e178af5a58
commit
0fbc9260a7
@ -949,8 +949,10 @@ msg_may_trunc(int force, char_u *s)
|
|||||||
int n;
|
int n;
|
||||||
int room;
|
int room;
|
||||||
|
|
||||||
|
// If something unexpected happened "room" may be negative, check for that
|
||||||
|
// just in case.
|
||||||
room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1;
|
room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1;
|
||||||
if ((force || (shortmess(SHM_TRUNC) && !exmode_active))
|
if (room > 0 && (force || (shortmess(SHM_TRUNC) && !exmode_active))
|
||||||
&& (n = (int)STRLEN(s) - room) > 0)
|
&& (n = (int)STRLEN(s) - room) > 0)
|
||||||
{
|
{
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
|
@ -735,6 +735,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
5161,
|
||||||
/**/
|
/**/
|
||||||
5160,
|
5160,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user