[PATCH 0/1] MR9335: crypt32/tests: Add null character to avoid buffer overrun (ASan).
These tests give intentionally ascii strings to unicode expecting functions. Therefore add these null characters to make them appear terminated to unicode functions. [ASan report details](https://gitlab.winehq.org/bernhardu/wine/-/blob/asan-pe_2025-10-18_wine-10.1...) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9335
From: Bernhard Übelacker <bernhardu(a)mailbox.org> These tests give intentionally ascii strings to unicode expecting functions. Therefore add these null characters to make them appear terminated to unicode functions. --- dlls/crypt32/tests/store.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index 1a899d1f1cd..09abf3d34aa 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -1394,7 +1394,7 @@ static void testSystemRegStore(void) "Expected E_INVALIDARG, got %08lx\n", GetLastError()); /* The name is expected to be UNICODE, check with an ASCII name */ store = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY, 0, 0, - CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_OPEN_EXISTING_FLAG, "My"); + CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_OPEN_EXISTING_FLAG, "My\0"); ok(!store && GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError()); } @@ -1419,7 +1419,7 @@ static void testSystemStore(void) "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError()); /* The name is expected to be UNICODE, first check with an ASCII name */ store = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, - CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_OPEN_EXISTING_FLAG, "My"); + CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_OPEN_EXISTING_FLAG, "My\0"); ok(!store && GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError()); /* Create the expected key */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9335
participants (1)
-
Bernhard Übelacker