Skip to content

Commit 0fbc926

Browse files
committed
patch 8.2.5161: might still access invalid memory
Problem: Might still access invalid memory. Solution: Add extra check for negative value.
1 parent e178af5 commit 0fbc926

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/message.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,8 +949,10 @@ msg_may_trunc(int force, char_u *s)
949949
int n;
950950
int room;
951951

952+
// If something unexpected happened "room" may be negative, check for that
953+
// just in case.
952954
room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1;
953-
if ((force || (shortmess(SHM_TRUNC) && !exmode_active))
955+
if (room > 0 && (force || (shortmess(SHM_TRUNC) && !exmode_active))
954956
&& (n = (int)STRLEN(s) - room) > 0)
955957
{
956958
if (has_mbyte)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ static char *(features[]) =
735735

736736
static int included_patches[] =
737737
{ /* Add new patch number below this line */
738+
/**/
739+
5161,
738740
/**/
739741
5160,
740742
/**/

0 commit comments

Comments
 (0)