Commit ae4de9d6 authored by Alexander Kochetkov's avatar Alexander Kochetkov Committed by Alexandre Julliard

oleaut32: Fix null terminator in SysReAllocStringLen.

parent b6da0725
......@@ -298,15 +298,12 @@ int WINAPI SysReAllocStringLen(BSTR* old, const OLECHAR* str, unsigned int len)
DWORD *ptr = HeapReAlloc(GetProcessHeap(),0,((DWORD*)*old)-1,newbytelen+sizeof(WCHAR)+sizeof(DWORD));
*old = (BSTR)(ptr+1);
*ptr = newbytelen;
if (str) {
memmove(*old, str, newbytelen);
(*old)[len] = 0;
} else {
/* Subtle hidden feature: The old string data is still there
* when 'in' is NULL!
* Some Microsoft program needs it.
*/
}
/* Subtle hidden feature: The old string data is still there
* when 'in' is NULL!
* Some Microsoft program needs it.
*/
if (str) memmove(*old, str, newbytelen);
(*old)[len] = 0;
} else {
/*
* Allocate the new string
......
......@@ -5422,7 +5422,7 @@ static void test_SysReAllocStringLen(void)
if (str)
{
ok (str == oldstr, "Expected reuse of the old string memory\n");
todo_wine ok (str[STRING_SIZE] == 0,
ok (str[STRING_SIZE] == 0,
"Expected null terminator, got 0x%04X\n", str[STRING_SIZE]);
SysFreeString(str);
}
......
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