Commit 066e0d5b authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

user: Set buffer to '\0' in GetKeyNameTextA too.

parent 88aeeb9f
...@@ -595,7 +595,10 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize) ...@@ -595,7 +595,10 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize)
INT ret; INT ret;
if (!GetKeyNameTextW(lParam, buf, 256)) if (!GetKeyNameTextW(lParam, buf, 256))
{
lpBuffer[0] = 0;
return 0; return 0;
}
ret = WideCharToMultiByte(CP_ACP, 0, buf, -1, lpBuffer, nSize, NULL, NULL); ret = WideCharToMultiByte(CP_ACP, 0, buf, -1, lpBuffer, nSize, NULL, NULL);
if (!ret && nSize) if (!ret && nSize)
{ {
......
...@@ -521,8 +521,22 @@ static void test_Input_blackbox(void) ...@@ -521,8 +521,22 @@ static void test_Input_blackbox(void)
DestroyWindow(window); DestroyWindow(window);
} }
static void test_keynames(void)
{
int i, len;
char buff[256];
for (i = 0; i < 512; i++)
{
strcpy(buff, "----");
len = GetKeyNameTextA(i << 16, buff, sizeof(buff));
ok(len || !buff[0], "%d: Buffer is not zeroed\n", i);
}
}
START_TEST(input) START_TEST(input)
{ {
test_Input_whitebox(); test_Input_whitebox();
test_Input_blackbox(); test_Input_blackbox();
test_keynames();
} }
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