Rob Shearman : ole32: Fix the length of data written and read for VT_CF types in property storage code .

Alexandre Julliard julliard at winehq.org
Mon Nov 30 10:42:44 CST 2009


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

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Sun Nov 29 10:33:44 2009 +0000

ole32: Fix the length of data written and read for VT_CF types in property storage code.

---

 dlls/ole32/stg_prop.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index bc45cea..643848a 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -1143,8 +1143,8 @@ static HRESULT PropertyStorage_ReadProperty(PropertyStorage_impl *This,
                 prop->u.pclipdata = CoTaskMemAlloc(sizeof (CLIPDATA));
                 prop->u.pclipdata->cbSize = len;
                 prop->u.pclipdata->ulClipFmt = tag;
-                prop->u.pclipdata->pClipData = CoTaskMemAlloc(len);
-                memcpy(prop->u.pclipdata->pClipData, data+8, len);
+                prop->u.pclipdata->pClipData = CoTaskMemAlloc(len - sizeof(prop->u.pclipdata->ulClipFmt));
+                memcpy(prop->u.pclipdata->pClipData, data+8, len - sizeof(prop->u.pclipdata->ulClipFmt));
             }
             else
                 hr = STG_E_INVALIDPARAMETER;
@@ -1735,7 +1735,8 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
         hr = IStream_Write(This->stm, cf_hdr, sizeof(cf_hdr), &count);
         if (FAILED(hr))
             goto end;
-        hr = IStream_Write(This->stm, var->u.pclipdata->pClipData, len, &count);
+        hr = IStream_Write(This->stm, var->u.pclipdata->pClipData,
+                           len - sizeof(var->u.pclipdata->ulClipFmt), &count);
         if (FAILED(hr))
             goto end;
         bytesWritten = count + sizeof cf_hdr;




More information about the wine-cvs mailing list