[PATCH] Check the return value before use

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed Jan 2 23:02:36 CST 2008


---
 dlls/msxml3/node.c         |    3 +++
 dlls/msxml3/tests/domdoc.c |    4 ++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 4ff28d9..93d0b93 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -218,6 +218,9 @@ static HRESULT WINAPI xmlnode_get_nodeValue(
     HRESULT r = S_FALSE;
 
     TRACE("%p %p\n", This, value);
+    
+    if(!value)
+        return E_INVALIDARG;
 
     V_BSTR(value) = NULL;
     V_VT(value) = VT_NULL;
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 912c2b7..2e1a02b 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -572,6 +572,10 @@ static void test_domnode( void )
 
     VariantInit(&var);
     ok( V_VT(&var) == VT_EMPTY, "variant init failed\n");
+    
+    r = IXMLDOMNode_get_nodeValue( doc, NULL );
+    ok(r == E_INVALIDARG, "get_nodeValue ret %08x\n", r );
+    
     r = IXMLDOMNode_get_nodeValue( doc, &var );
     ok( r == S_FALSE, "nextNode returned wrong code\n");
     ok( V_VT(&var) == VT_NULL, "variant wasn't empty\n");
-- 
1.5.3.6


--------------060909070901060504000802--




More information about the wine-patches mailing list