Robert Shearman : oleaut32: Initialise BSTR pointer to NULL in VARIANT_UserUnmarshal.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 18 10:15:47 CDT 2006


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

Author: Robert Shearman <rob at codeweavers.com>
Date:   Tue Apr 18 11:56:14 2006 +0100

oleaut32: Initialise BSTR pointer to NULL in VARIANT_UserUnmarshal.

Initialise BSTR pointer to NULL before calling BSTR_UserUnmarshal,
otherwise BSTR_UserUnmarshal will try to use the memory in the
pointer.

---

 dlls/oleaut32/usrmarshal.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dlls/oleaut32/usrmarshal.c b/dlls/oleaut32/usrmarshal.c
index 961304f..4374348 100644
--- a/dlls/oleaut32/usrmarshal.c
+++ b/dlls/oleaut32/usrmarshal.c
@@ -462,11 +462,12 @@ unsigned char * WINAPI VARIANT_UserUnmar
 
   switch (var->vt) {
   case VT_BSTR:
+    V_BSTR(pvar) = NULL;
     Pos = BSTR_UserUnmarshal(pFlags, Pos, &V_BSTR(pvar));
     break;
   case VT_BSTR | VT_BYREF:
     pvar->n1.n2.n3.byref = CoTaskMemAlloc(sizeof(BSTR));
-    *(BSTR*)pvar->n1.n2.n3.byref = NULL;
+    *(BSTR*)V_BYREF(pvar) = NULL;
     Pos = BSTR_UserUnmarshal(pFlags, Pos, V_BSTRREF(pvar));
     break;
   case VT_VARIANT | VT_BYREF:




More information about the wine-cvs mailing list