Skip to content

Commit 4e5b9e3

Browse files
committed
patch 9.2.0078: [security]: stack-buffer-overflow in build_stl_str_hl()
Problem: A stack-buffer-overflow occurs when rendering a statusline with a multi-byte fill character on a very wide terminal. The size check in build_stl_str_hl() uses the cell width rather than the byte length, allowing the subsequent fill loop to write beyond the 4096-byte MAXPATHL buffer (ehdgks0627, un3xploitable). Solution: Update the size check to account for the byte length of the fill character (using MB_CHAR2LEN). Github Advisory: https://github.com/vim/vim/security/advisories/GHSA-gmqx-prf2-8mwf Signed-off-by: Christian Brabandt <[email protected]>
1 parent 65c1a14 commit 4e5b9e3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/buffer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5296,7 +5296,8 @@ build_stl_str_hl(
52965296
}
52975297
width = maxwidth;
52985298
}
5299-
else if (width < maxwidth && outputlen + maxwidth - width + 1 < outlen)
5299+
else if (width < maxwidth &&
5300+
outputlen + (maxwidth - width) * MB_CHAR2LEN(fillchar) + 1 < outlen)
53005301
{
53015302
// Find how many separators there are, which we will use when
53025303
// figuring out how many groups there are.

src/version.c

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

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
78,
737739
/**/
738740
77,
739741
/**/

0 commit comments

Comments
 (0)