[PATCH] Validated attribute name
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Fri Feb 1 03:45:02 CST 2008
---
dlls/msxml3/element.c | 9 +++++++--
dlls/msxml3/tests/domdoc.c | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c
index ba01247..5cfd4ba 100644
--- a/dlls/msxml3/element.c
+++ b/dlls/msxml3/element.c
@@ -458,7 +458,7 @@ static HRESULT WINAPI domelem_getAttribute(
{
domelem *This = impl_from_IXMLDOMElement( iface );
xmlNodePtr element;
- xmlChar *xml_name, *xml_value;
+ xmlChar *xml_name, *xml_value = NULL;
HRESULT hr = S_FALSE;
TRACE("(%p)->(%s,%p)\n", This, debugstr_w(name), value);
@@ -474,7 +474,12 @@ static HRESULT WINAPI domelem_getAttribute(
V_VT(value) = VT_NULL;
xml_name = xmlChar_from_wchar( name );
- xml_value = xmlGetNsProp(element, xml_name, NULL);
+
+ if(!xmlValidateNameValue(xml_name))
+ hr = E_FAIL;
+ else
+ xml_value = xmlGetNsProp(element, xml_name, NULL);
+
HeapFree(GetProcessHeap(), 0, xml_name);
if(xml_value)
{
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 4507d08..e5dfbcc 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -719,7 +719,7 @@ static void test_domnode( void )
V_VT(&var) = VT_I4;
V_I4(&var) = 0x1234;
r = IXMLDOMElement_getAttribute( element, str, &var );
- ok( r == S_FALSE, "getAttribute ret %08x\n", r );
+ ok( r == E_FAIL, "getAttribute ret %08x\n", r );
ok( V_VT(&var) == VT_NULL, "vt = %x\n", V_VT(&var));
VariantClear(&var);
SysFreeString( str );
--
1.5.3.8
--------------080502080704040204000000--
More information about the wine-patches
mailing list