msxml3: Avoid SysStringLen() testing for an empty string in ::createNode().

This commit is contained in:
Nikolay Sivov 2010-06-13 04:23:23 +04:00 committed by Alexandre Julliard
parent 43d9c9bb41
commit 3611791117
2 changed files with 12 additions and 1 deletions

View File

@ -1368,7 +1368,7 @@ static HRESULT WINAPI domdoc_createNode(
case NODE_ATTRIBUTE:
case NODE_ENTITY_REFERENCE:
case NODE_PROCESSING_INSTRUCTION:
if (!name || SysStringLen(name) == 0) return E_FAIL;
if (!name || *name == 0) return E_FAIL;
default:
break;
}

View File

@ -1988,6 +1988,17 @@ static void test_create(void)
if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
SysFreeString(str);
/* a name is required for attribute, try a BSTR with first null wchar */
V_VT(&var) = VT_I1;
V_I1(&var) = NODE_ATTRIBUTE;
str = SysAllocString( szstr1 );
str[0] = 0;
node = (IXMLDOMNode*)0x1;
r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
ok( r == E_FAIL, "returns %08x\n", r );
ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
SysFreeString(str);
/* NODE_PROCESSING_INSTRUCTION */
V_VT(&var) = VT_I1;
V_I1(&var) = NODE_PROCESSING_INSTRUCTION;