Colin Finck : mshtml: Fix the size passed to MultiByteToWideChar.

Alexandre Julliard julliard at winehq.org
Thu Apr 23 11:27:22 CDT 2009


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

Author: Colin Finck <mail at colinfinck.de>
Date:   Wed Apr 22 21:31:48 2009 +0200

mshtml: Fix the size passed to MultiByteToWideChar.

---

 dlls/mshtml/install.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/install.c b/dlls/mshtml/install.c
index 15f6d93..2dd91d8 100644
--- a/dlls/mshtml/install.c
+++ b/dlls/mshtml/install.c
@@ -425,6 +425,7 @@ static LPWSTR get_url(void)
     HKEY hkey;
     DWORD res, type;
     DWORD size = INTERNET_MAX_URL_LENGTH*sizeof(WCHAR);
+    DWORD returned_size;
     LPWSTR url;
 
     static const WCHAR wszGeckoUrl[] = {'G','e','c','k','o','U','r','l',0};
@@ -437,15 +438,16 @@ static LPWSTR get_url(void)
         return NULL;
 
     url = heap_alloc(size);
+    returned_size = size;
 
-    res = RegQueryValueExW(hkey, wszGeckoUrl, NULL, &type, (LPBYTE)url, &size);
+    res = RegQueryValueExW(hkey, wszGeckoUrl, NULL, &type, (LPBYTE)url, &returned_size);
     RegCloseKey(hkey);
     if(res != ERROR_SUCCESS || type != REG_SZ) {
         heap_free(url);
         return NULL;
     }
 
-    if(size > sizeof(httpW) && !memcmp(url, httpW, sizeof(httpW))) {
+    if(returned_size > sizeof(httpW) && !memcmp(url, httpW, sizeof(httpW))) {
         strcatW(url, v_formatW);
         MultiByteToWideChar(CP_ACP, 0, GECKO_VERSION, -1, url+strlenW(url), size/sizeof(WCHAR)-strlenW(url));
     }




More information about the wine-cvs mailing list