mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 22:47:19 +00:00
xmllite/writer: Null terminate duplicated strings.
Strings are not being "partially duplicated", but duplicated with explicit length. Signed-off-by: David Kahurani <k.kahurani@gmail.com>
This commit is contained in:
parent
e3f00bf7c9
commit
556b3981b7
|
@ -250,7 +250,6 @@ static struct element *pop_element(xmlwriter *writer)
|
|||
|
||||
static WCHAR *writer_strndupW(const xmlwriter *writer, const WCHAR *str, int len)
|
||||
{
|
||||
size_t size;
|
||||
WCHAR *ret;
|
||||
|
||||
if (!str)
|
||||
|
@ -259,9 +258,12 @@ static WCHAR *writer_strndupW(const xmlwriter *writer, const WCHAR *str, int len
|
|||
if (len == -1)
|
||||
len = lstrlenW(str);
|
||||
|
||||
size = (len + 1) * sizeof(WCHAR);
|
||||
ret = writer_alloc(writer, size);
|
||||
if (ret) memcpy(ret, str, size);
|
||||
ret = writer_alloc(writer, (len + 1) * sizeof(WCHAR));
|
||||
if (ret)
|
||||
{
|
||||
memcpy(ret, str, len * sizeof(WCHAR));
|
||||
ret[len] = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue