user[1/2]: Set buffer to '\0' in ascii variant too.
Vitaliy Margolen
wine-patch at kievinfo.com
Sat Jul 29 20:28:26 CDT 2006
ChangeLog:
user: Set buffer to '\0' in ascii variant too.
dlls/user/input.c | 3 +++
dlls/user/tests/input.c | 14 ++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
-------------- next part --------------
58fbe61818b06daeb499cd798e5d189e344ff150
diff --git a/dlls/user/input.c b/dlls/user/input.c
index 26c3b96..24ffed7 100644
--- a/dlls/user/input.c
+++ b/dlls/user/input.c
@@ -595,7 +595,10 @@ INT WINAPI GetKeyNameTextA(LONG lParam,
INT ret;
if (!GetKeyNameTextW(lParam, buf, 256))
+ {
+ lpBuffer[0] = 0;
return 0;
+ }
ret = WideCharToMultiByte(CP_ACP, 0, buf, -1, lpBuffer, nSize, NULL, NULL);
if (!ret && nSize)
{
diff --git a/dlls/user/tests/input.c b/dlls/user/tests/input.c
index 7627f42..159b398 100644
--- a/dlls/user/tests/input.c
+++ b/dlls/user/tests/input.c
@@ -521,8 +521,22 @@ static void test_Input_blackbox(void)
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)
{
test_Input_whitebox();
test_Input_blackbox();
+ test_keynames();
}
More information about the wine-patches
mailing list