Akihiro Sagawa : advapi32: Improve parameter sanity checks in RegLoadMUIString.

Alexandre Julliard julliard at winehq.org
Mon May 13 16:24:17 CDT 2019


Module: wine
Branch: master
Commit: ec716f74d7a6f1a878138f943f09b8c888a69cd7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ec716f74d7a6f1a878138f943f09b8c888a69cd7

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Thu May  9 22:07:28 2019 +0900

advapi32: Improve parameter sanity checks in RegLoadMUIString.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/advapi32/registry.c       | 2 +-
 dlls/advapi32/tests/registry.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c
index 469818c..a9a5841 100644
--- a/dlls/advapi32/registry.c
+++ b/dlls/advapi32/registry.c
@@ -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. */
diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c
index d6edb02..ccda877 100644
--- a/dlls/advapi32/tests/registry.c
+++ b/dlls/advapi32/tests/registry.c
@@ -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));




More information about the wine-cvs mailing list