Currently, the code copies one extra character than requested and does not terminate the string.
Signed-off-by: David Kahurani k.kahurani@gmail.com
-- v5: xmllite/writer: Null terminate duplicated strings
From: David Kahurani k.kahurani@gmail.com
Strings are not being "partially duplicated", but duplicated with explicit length.
Signed-off-by: David Kahurani k.kahurani@gmail.com --- dlls/xmllite/writer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/xmllite/writer.c b/dlls/xmllite/writer.c index c4f9ed2f440..065716f7e8c 100644 --- a/dlls/xmllite/writer.c +++ b/dlls/xmllite/writer.c @@ -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; }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125027
Your paranoid android.
=== debian11 (32 bit report) ===
dxva2: dxva2: Timeout
evr: evr: Timeout
explorerframe: nstc: Timeout taskbarlist: Timeout
gameux: gameexplorer: Timeout gamestatistics: Timeout
gdi32: bitmap: Timeout brush: Timeout clipping: Timeout dc: Timeout dib: Timeout driver: Timeout font: Timeout gdiobj: Timeout icm: Timeout mapping: Timeout metafile: Timeout palette: Timeout
Report validation errors: path: Timeout
=== debian11 (build log) ===
WineRunWineTest.pl:error: The task timed out