Commit de09e9b9 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite/tests: Fix buffer overflow when filling test string.

parent b46a6284
......@@ -927,7 +927,7 @@ todo_wine {
static void test_SetLocaleName(void)
{
static const WCHAR strW[] = {'a','b','c','d',0};
WCHAR buffW[LOCALE_NAME_MAX_LENGTH+5];
WCHAR buffW[LOCALE_NAME_MAX_LENGTH+sizeof(strW)/sizeof(WCHAR)];
IDWriteTextFormat *format;
IDWriteTextLayout *layout;
DWRITE_TEXT_RANGE range;
......@@ -971,9 +971,7 @@ if (0) /* crashes on native */
/* name is too long */
lstrcpyW(buffW, strW);
while (lstrlenW(buffW) < LOCALE_NAME_MAX_LENGTH) {
lstrcatW(buffW, strW);
}
while (lstrlenW(buffW) <= LOCALE_NAME_MAX_LENGTH)
lstrcatW(buffW, strW);
range.startPosition = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment