Commit 9ae103f7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Respect string length returned from ISAXAttributes.

parent d0413fd4
...@@ -782,7 +782,7 @@ static HRESULT WINAPI mxwriter_saxcontent_startElement( ...@@ -782,7 +782,7 @@ static HRESULT WINAPI mxwriter_saxcontent_startElement(
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
{ {
const WCHAR *str; const WCHAR *str;
INT len; INT len = 0;
hr = ISAXAttributes_getQName(attr, i, &str, &len); hr = ISAXAttributes_getQName(attr, i, &str, &len);
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
...@@ -790,16 +790,17 @@ static HRESULT WINAPI mxwriter_saxcontent_startElement( ...@@ -790,16 +790,17 @@ static HRESULT WINAPI mxwriter_saxcontent_startElement(
/* space separator in front of every attribute */ /* space separator in front of every attribute */
xmlOutputBufferWriteString(This->buffer, " "); xmlOutputBufferWriteString(This->buffer, " ");
s = xmlchar_from_wchar(str); s = xmlchar_from_wcharn(str, len);
xmlOutputBufferWriteString(This->buffer, (char*)s); xmlOutputBufferWriteString(This->buffer, (char*)s);
heap_free(s); heap_free(s);
xmlOutputBufferWriteString(This->buffer, "=\""); xmlOutputBufferWriteString(This->buffer, "=\"");
len = 0;
hr = ISAXAttributes_getValue(attr, i, &str, &len); hr = ISAXAttributes_getValue(attr, i, &str, &len);
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
s = xmlchar_from_wchar(str); s = xmlchar_from_wcharn(str, len);
xmlOutputBufferWriteString(This->buffer, (char*)s); xmlOutputBufferWriteString(This->buffer, (char*)s);
heap_free(s); heap_free(s);
......
...@@ -567,13 +567,13 @@ static HRESULT WINAPI isaxattributes_getQName( ...@@ -567,13 +567,13 @@ static HRESULT WINAPI isaxattributes_getQName(
const WCHAR **pQName, const WCHAR **pQName,
int *pQNameLength) int *pQNameLength)
{ {
static const WCHAR attr1W[] = {'a',':','a','t','t','r','1',0}; static const WCHAR attr1W[] = {'a',':','a','t','t','r','1','j','u','n','k',0};
static const WCHAR attr2W[] = {'a','t','t','r','2',0}; static const WCHAR attr2W[] = {'a','t','t','r','2','j','u','n','k',0};
ok(nIndex == 0 || nIndex == 1, "invalid index received %d\n", nIndex); ok(nIndex == 0 || nIndex == 1, "invalid index received %d\n", nIndex);
*pQName = (nIndex == 0) ? attr1W : attr2W; *pQName = (nIndex == 0) ? attr1W : attr2W;
*pQNameLength = lstrlenW(*pQName); *pQNameLength = (nIndex == 0) ? 7 : 5;
return S_OK; return S_OK;
} }
...@@ -654,13 +654,13 @@ static HRESULT WINAPI isaxattributes_getValue( ...@@ -654,13 +654,13 @@ static HRESULT WINAPI isaxattributes_getValue(
const WCHAR ** pValue, const WCHAR ** pValue,
int * nValue) int * nValue)
{ {
static const WCHAR attrval1W[] = {'a','1',0}; static const WCHAR attrval1W[] = {'a','1','j','u','n','k',0};
static const WCHAR attrval2W[] = {'a','2',0}; static const WCHAR attrval2W[] = {'a','2','j','u','n','k',0};
ok(nIndex == 0 || nIndex == 1, "invalid index received %d\n", nIndex); ok(nIndex == 0 || nIndex == 1, "invalid index received %d\n", nIndex);
*pValue = (nIndex == 0) ? attrval1W : attrval2W; *pValue = (nIndex == 0) ? attrval1W : attrval2W;
*nValue = lstrlenW(*pValue); *nValue = 2;
return S_OK; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment