[PATCH 1/2 v3] ole2: Fix error handling in ReadClassStg()

Nikolay Sivov nsivov at codeweavers.com
Sun Jan 10 12:45:48 CST 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/ole2.dll16/ole2.c | 11 +++++++++--

v3: without additional header for error codes this time

 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/ole2.dll16/ole2.c b/dlls/ole2.dll16/ole2.c
index 0052142..422469d 100644
--- a/dlls/ole2.dll16/ole2.c
+++ b/dlls/ole2.dll16/ole2.c
@@ -46,6 +46,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
+#define E_INVALIDARG16 MAKE_SCODE(SEVERITY_ERROR, FACILITY_NULL, 3)
 
 static HICON convert_icon_to_32( HICON16 icon16 )
 {
@@ -296,8 +297,14 @@ HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid)
 
 	TRACE("(%x, %p)\n", pstg, pclsid);
 
-	if(pclsid==NULL)
-		return E_POINTER;
+	if (!pclsid)
+	    return E_INVALIDARG16;
+
+	memset(pclsid, 0, sizeof(*pclsid));
+
+	if (!pstg)
+	    return E_INVALIDARG16;
+
 	/*
 	 * read a STATSTG structure (contains the clsid) from the storage
 	 */
-- 
2.6.4




More information about the wine-patches mailing list