Fix buffer overflow in xdrawglyph() (#119)

The buffer overflow occurs when the ligatures patch is enabled and
xmakeglyphfontspecs() returns more than one XftGlyphFontSpec.

Ref. https://github.com/cog1to/st-ligatures/issues/35
This commit is contained in:
veltza 2024-03-11 23:54:16 +02:00 committed by GitHub
parent a28f3e0d39
commit 9a41526bfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

6
x.c
View File

@ -2553,10 +2553,10 @@ void
xdrawglyph(Glyph g, int x, int y) xdrawglyph(Glyph g, int x, int y)
{ {
int numspecs; int numspecs;
XftGlyphFontSpec spec; XftGlyphFontSpec *specs = xw.specbuf;
numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y); numspecs = xmakeglyphfontspecs(specs, &g, 1, x, y);
xdrawglyphfontspecs(&spec, g, numspecs, x, y xdrawglyphfontspecs(specs, g, numspecs, x, y
#if WIDE_GLYPHS_PATCH #if WIDE_GLYPHS_PATCH
,DRAW_BG | DRAW_FG ,DRAW_BG | DRAW_FG
#endif // WIDE_GLYPHS_PATCH #endif // WIDE_GLYPHS_PATCH