Commit 556b3981 authored by David Kahurani's avatar David Kahurani Committed by Alexandre Julliard

xmllite/writer: Null terminate duplicated strings.

Strings are not being "partially duplicated", but duplicated with explicit length. Signed-off-by: 's avatarDavid Kahurani <k.kahurani@gmail.com>
parent e3f00bf7
......@@ -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;
}
......
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