Robert Wilhelm : scrrun: Check for null arguments in MoveFile.
Module: wine Branch: master Commit: e5ae7a4026f46181d6a45a2026e78a4e177ba279 URL: https://source.winehq.org/git/wine.git/?a=commit;h=e5ae7a4026f46181d6a45a202... Author: Robert Wilhelm <robert.wilhelm(a)gmx.net> Date: Wed May 25 14:53:11 2022 +0200 scrrun: Check for null arguments in MoveFile. Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/scrrun/filesystem.c | 3 +++ dlls/scrrun/tests/filesystem.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/dlls/scrrun/filesystem.c b/dlls/scrrun/filesystem.c index d7ad255e517..35b43e2f124 100644 --- a/dlls/scrrun/filesystem.c +++ b/dlls/scrrun/filesystem.c @@ -3758,6 +3758,9 @@ static HRESULT WINAPI filesys_MoveFile(IFileSystem3 *iface, BSTR source, BSTR de { TRACE("%p %s %s\n", iface, debugstr_w(source), debugstr_w(destination)); + if(!source || !destination) + return E_INVALIDARG; + return MoveFileW(source, destination) ? S_OK : create_error(GetLastError()); } diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index 79af87591ff..1ba0e81a2d1 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -2591,6 +2591,13 @@ static void test_MoveFile(void) hr = IFileSystem3_DeleteFile(fs3, str, VARIANT_TRUE); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); SysFreeString(str); + + str = SysAllocString(L"null.txt"); + hr = IFileSystem3_MoveFile(fs3, str, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + hr = IFileSystem3_MoveFile(fs3, NULL, str); + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + SysFreeString(str); } static void test_DoOpenPipeStream(void)
participants (1)
-
Alexandre Julliard