mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 19:33:38 +00:00
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: Eduard Permyakov <epermyakov@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4303e75313
commit
2d33f406c9
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue