From: Yuxuan Shui yshui@codeweavers.com
Using test_cmd_w_to_w[str_index - 1] is illegal if str_index is 0. --- dlls/user32/tests/dde.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c index cd97bef165d..00fa72e1fa0 100644 --- a/dlls/user32/tests/dde.c +++ b/dlls/user32/tests/dde.c @@ -2430,13 +2430,16 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV if (winetest_debug > 1) trace("msg %u strA "%s" strW %s\n", msg_index, buffer, wine_dbgstr_w((WCHAR*)buffer));
str_index = msg_index - 4; - cmd_w = test_cmd_w_to_w[str_index - 1]; size_a = strlen(test_cmd_a_to_a) + 1; - size_w = (lstrlenW(cmd_w) + 1) * sizeof(WCHAR); size_a_to_w = MultiByteToWideChar( CP_ACP, 0, test_cmd_a_to_a, -1, test_cmd_a_to_w, ARRAY_SIZE(test_cmd_a_to_w)) * sizeof(WCHAR); - size_w_to_a = WideCharToMultiByte( CP_ACP, 0, cmd_w, -1, - test_cmd_w_to_a, sizeof(test_cmd_w_to_a), NULL, NULL ); + if (str_index) + { + cmd_w = test_cmd_w_to_w[str_index - 1]; + size_w = (lstrlenW(cmd_w) + 1) * sizeof(WCHAR); + size_w_to_a = WideCharToMultiByte( CP_ACP, 0, cmd_w, -1, + test_cmd_w_to_a, sizeof(test_cmd_w_to_a), NULL, NULL ); + } switch (str_index) { case 0: /* ANSI string */