Huw Davies : user32: Fix a potential buffer overflow.

Alexandre Julliard julliard at winehq.org
Fri Apr 21 15:18:17 CDT 2017


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Apr 21 15:07:31 2017 +0100

user32: Fix a potential buffer overflow.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/sysparams.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index 63c4ffe..67b052e 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -548,7 +548,7 @@ static DWORD load_entry( struct sysparam_entry *entry, void *data, DWORD size )
         if (RegQueryValueExW( base_key, entry->regval + 1, NULL, &type, data, &count )) count = 0;
     }
     /* make sure strings are null-terminated */
-    if (size && count == size && type == REG_SZ) ((WCHAR *)data)[count - 1] = 0;
+    if (size && count == size && type == REG_SZ) ((WCHAR *)data)[count / sizeof(WCHAR) - 1] = 0;
     entry->loaded = TRUE;
     return count;
 }




More information about the wine-cvs mailing list