Alexandre Julliard : ntoskrnl.exe/tests: Fix path buffer allocation size.
Alexandre Julliard
julliard at winehq.org
Thu Jan 17 16:08:48 CST 2019
Module: wine
Branch: master
Commit: 5bfa5f1e3994a43ba0b0c2f8ed2735e096722578
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5bfa5f1e3994a43ba0b0c2f8ed2735e096722578
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Jan 17 19:42:42 2019 +0100
ntoskrnl.exe/tests: Fix path buffer allocation size.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntoskrnl.exe/tests/ntoskrnl.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 9ab05bc..2dc86ee 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -144,7 +144,7 @@ static void main_test(void)
WCHAR temppathW[MAX_PATH], pathW[MAX_PATH];
struct test_input *test_input;
UNICODE_STRING pathU;
- DWORD written, read;
+ DWORD len, written, read;
LONG new_failures;
char buffer[512];
HANDLE okfile;
@@ -155,13 +155,14 @@ static void main_test(void)
GetTempFileNameW(temppathW, dokW, 0, pathW);
pRtlDosPathNameToNtPathName_U( pathW, &pathU, NULL, NULL );
- test_input = heap_alloc( offsetof( struct test_input, path[pathU.Length / sizeof(WCHAR)]) );
+ len = pathU.Length + sizeof(WCHAR);
+ test_input = heap_alloc( offsetof( struct test_input, path[len / sizeof(WCHAR)]) );
test_input->running_under_wine = !strcmp(winetest_platform, "wine");
test_input->winetest_report_success = winetest_report_success;
test_input->winetest_debug = winetest_debug;
- memcpy(test_input->path, pathU.Buffer, pathU.Length + sizeof(WCHAR));
+ memcpy(test_input->path, pathU.Buffer, len);
res = DeviceIoControl(device, IOCTL_WINETEST_MAIN_TEST, test_input,
- offsetof( struct test_input, path[pathU.Length / sizeof(WCHAR)]),
+ offsetof( struct test_input, path[len / sizeof(WCHAR)]),
&new_failures, sizeof(new_failures), &written, NULL);
ok(res, "DeviceIoControl failed: %u\n", GetLastError());
ok(written == sizeof(new_failures), "got size %x\n", written);
More information about the wine-cvs
mailing list