Jacek Caban : mshtml: Fixed invalid use of -1 length in WideCharToMultiByte calls.

Alexandre Julliard julliard at winehq.org
Thu Mar 27 07:21:45 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Mar 26 15:32:46 2008 +0100

mshtml: Fixed invalid use of -1 length in WideCharToMultiByte calls.

---

 dlls/mshtml/editor.c  |    7 +------
 dlls/mshtml/install.c |    7 ++-----
 dlls/mshtml/persist.c |    2 +-
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index 057ac24..12f2c35 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -559,7 +559,6 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
 
     if(in) {
         char *stra;
-        DWORD len;
 
         if(V_VT(in) != VT_BSTR) {
             FIXME("Unsupported vt=%d\n", V_VT(out));
@@ -568,12 +567,8 @@ static HRESULT exec_fontname(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
 
         TRACE("%s\n", debugstr_w(V_BSTR(in)));
 
-        len = WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, NULL, 0, NULL, NULL);
-        stra = heap_alloc(len);
-        WideCharToMultiByte(CP_ACP, 0, V_BSTR(in), -1, stra, -1, NULL, NULL);
-
+        stra = heap_strdupWtoA(V_BSTR(in));
         set_ns_fontname(This->nscontainer, stra);
-
         heap_free(stra);
 
         update_doc(This, UPDATE_UI);
diff --git a/dlls/mshtml/install.c b/dlls/mshtml/install.c
index fd36290..edb5f58 100644
--- a/dlls/mshtml/install.c
+++ b/dlls/mshtml/install.c
@@ -135,7 +135,7 @@ static BOOL install_cab(LPCWSTR file_name)
     char install_dir[MAX_PATH];
     HRESULT (WINAPI *pExtractFilesA)(LPCSTR,LPCSTR,DWORD,LPCSTR,LPVOID,DWORD);
     LPSTR file_name_a;
-    DWORD res, len;
+    DWORD res;
     HRESULT hres;
 
     static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0};
@@ -160,11 +160,8 @@ static BOOL install_cab(LPCWSTR file_name)
     advpack = LoadLibraryW(wszAdvpack);
     pExtractFilesA = (void *)GetProcAddress(advpack, "ExtractFiles");
 
-    len = WideCharToMultiByte(CP_ACP, 0, file_name, -1, NULL, 0, NULL, NULL);
-    file_name_a = heap_alloc(len);
-    WideCharToMultiByte(CP_ACP, 0, file_name, -1, file_name_a, -1, NULL, NULL);
-
     /* FIXME: Use unicode version (not yet implemented) */
+    file_name_a = heap_strdupWtoA(file_name);
     hres = pExtractFilesA(file_name_a, install_dir, 0, NULL, NULL, 0);
     FreeLibrary(advpack);
     heap_free(file_name_a);
diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c
index a094dc1..78a5d6b 100644
--- a/dlls/mshtml/persist.c
+++ b/dlls/mshtml/persist.c
@@ -134,7 +134,7 @@ static nsIInputStream *get_post_data_stream(IBindCtx *bctx)
         data = heap_alloc(headers_len+post_len+sizeof(content_length)+8);
 
         if(headers_len) {
-            WideCharToMultiByte(CP_ACP, 0, headers, -1, data, -1, NULL, NULL);
+            WideCharToMultiByte(CP_ACP, 0, headers, -1, data, headers_len, NULL, NULL);
             len = fix_headers(data, post_len);
         }
 




More information about the wine-cvs mailing list