Commit 2d33f406 authored by Eduard Permyakov's avatar Eduard Permyakov Committed by Alexandre Julliard

xmllite: Don't lose terminating character when shrinking buffer.

The utf16 buffer is expected to be terminated by a '0' character. Flawed buffer shrinking logic would move the buffer contents but forget about the terminating character, which could cause reading junk past the end of the buffer contents. Signed-off-by: 's avatarEduard Permyakov <epermyakov@codeweavers.com> Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 4303e753
......@@ -2128,6 +2128,7 @@ static HRESULT reader_parse_reference(xmlreader *reader)
memmove(start + 1, ptr + 1, len);
buffer->written -= (reader_get_cur(reader) - cur) * sizeof(WCHAR);
*(WCHAR*)(buffer->data + buffer->written) = 0;
buffer->cur = cur + 1;
*start = ch;
......@@ -2151,6 +2152,7 @@ static HRESULT reader_parse_reference(xmlreader *reader)
memmove(start+1, ptr+1, len);
buffer->cur = cur + 1;
buffer->written -= (ptr - start) * sizeof(WCHAR);
*(WCHAR*)(buffer->data + buffer->written) = 0;
*start = ch;
}
......
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