mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 19:49:50 +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
1 changed files with 2 additions and 0 deletions
|
@ -2128,6 +2128,7 @@ static HRESULT reader_parse_reference(xmlreader *reader)
|
||||||
memmove(start + 1, ptr + 1, len);
|
memmove(start + 1, ptr + 1, len);
|
||||||
|
|
||||||
buffer->written -= (reader_get_cur(reader) - cur) * sizeof(WCHAR);
|
buffer->written -= (reader_get_cur(reader) - cur) * sizeof(WCHAR);
|
||||||
|
*(WCHAR*)(buffer->data + buffer->written) = 0;
|
||||||
buffer->cur = cur + 1;
|
buffer->cur = cur + 1;
|
||||||
|
|
||||||
*start = ch;
|
*start = ch;
|
||||||
|
@ -2151,6 +2152,7 @@ static HRESULT reader_parse_reference(xmlreader *reader)
|
||||||
memmove(start+1, ptr+1, len);
|
memmove(start+1, ptr+1, len);
|
||||||
buffer->cur = cur + 1;
|
buffer->cur = cur + 1;
|
||||||
buffer->written -= (ptr - start) * sizeof(WCHAR);
|
buffer->written -= (ptr - start) * sizeof(WCHAR);
|
||||||
|
*(WCHAR*)(buffer->data + buffer->written) = 0;
|
||||||
|
|
||||||
*start = ch;
|
*start = ch;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue