mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
Fix buffer overflow when getting text extents
lfFaceName needs to be null-terminated, so only copy up to 31 characters into the buffer.
This commit is contained in:
parent
8a5b4ae3a3
commit
e60197962a
@ -86,7 +86,7 @@ namespace Automation4 {
|
||||
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
|
||||
lf.lfQuality = ANTIALIASED_QUALITY;
|
||||
lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE;
|
||||
wcsncpy(lf.lfFaceName, agi::charset::ConvertW(style->font).c_str(), 32);
|
||||
wcsncpy(lf.lfFaceName, agi::charset::ConvertW(style->font).c_str(), 31);
|
||||
|
||||
HFONT thefont = CreateFontIndirect(&lf);
|
||||
if (!thefont) return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user