Module: wine Branch: oldstable Commit: 77240624fa5098e1c21b07901065a5368b0675a7 URL: https://gitlab.winehq.org/wine/wine/-/commit/77240624fa5098e1c21b07901065a53...
Author: Robert Wilhelm robert.wilhelm@gmx.net Date: Fri Aug 19 10:54:25 2022 +0200
scrrun: Correct string length returned from GetTempName.
You have to pass string length without terminal null to SysAllocStringLen.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53569 (cherry picked from commit 1f4c48a0007341589bb7c17b95268669c988bfbc) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/scrrun/filesystem.c | 2 +- dlls/scrrun/tests/filesystem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c index 290a643c29a..28636800131 100644 --- a/dlls/scrrun/filesystem.c +++ b/dlls/scrrun/filesystem.c @@ -3324,7 +3324,7 @@ static HRESULT WINAPI filesys_GetTempName(IFileSystem3 *iface, BSTR *result) if (!result) return E_POINTER;
- if (!(*result = SysAllocStringLen(NULL, 13))) + if (!(*result = SysAllocStringLen(NULL, 12))) return E_OUTOFMEMORY;
if(!RtlGenRandom(&random, sizeof(random))) diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index f8095747af9..d6907abb103 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -483,7 +483,7 @@ static void test_GetTempName(void) hr = IFileSystem3_GetTempName(fs3, &result); ok(hr == S_OK, "GetTempName returned %x, expected S_OK\n", hr); ok(!!wcsstr( result,L".tmp"), "GetTempName returned %s, expected .tmp suffix\n", debugstr_w(result)); - todo_wine ok(SysStringLen(result) == lstrlenW(result),"GetTempName returned %s, has incorrect string len.\n", debugstr_w(result)); + ok(SysStringLen(result) == lstrlenW(result),"GetTempName returned %s, has incorrect string len.\n", debugstr_w(result)); SysFreeString(result); }