Commit ec716f74 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

advapi32: Improve parameter sanity checks in RegLoadMUIString.

parent 1b7f3698
......@@ -3183,7 +3183,7 @@ LSTATUS WINAPI RegLoadMUIStringW(HKEY hKey, LPCWSTR pwszValue, LPWSTR pwszBuffer
cbBuffer, pcbData, dwFlags, debugstr_w(pwszBaseDir));
/* Parameter sanity checks. */
if (!hKey || !pwszBuffer)
if (!hKey || (!pwszBuffer && cbBuffer) || (cbBuffer % sizeof(WCHAR)))
return ERROR_INVALID_PARAMETER;
/* Check for value existence and correctness of its type, allocate a buffer and load it. */
......
......@@ -3896,8 +3896,8 @@ static void test_RegLoadMUIString(void)
memset(bufW, 0xff, sizeof(bufW));
ret = pRegLoadMUIStringW(hkey, tz_valueW, bufW, sizeof(WCHAR)+1, &size, 0, NULL);
todo_wine ok(ret == ERROR_INVALID_PARAMETER, "got %d, expected ERROR_INVALID_PARAMETER\n", ret);
todo_wine ok(bufW[0] == 0xffff, "got 0x%04x, expected 0xffff\n", bufW[0]);
ok(ret == ERROR_INVALID_PARAMETER, "got %d, expected ERROR_INVALID_PARAMETER\n", ret);
ok(bufW[0] == 0xffff, "got 0x%04x, expected 0xffff\n", bufW[0]);
size = 0xdeadbeef;
memset(bufW, 0xff, sizeof(bufW));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment