Skip to content
Snippets Groups Projects
Commit deebddf2 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard
Browse files

SysAllocStringLen16 needs to handle NULL pointers, too.

parent 7d6e1ea5
No related branches found
No related tags found
No related merge requests found
......@@ -105,8 +105,20 @@ INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR in)
BSTR16 WINAPI SysAllocStringLen16(const char *in, int len)
{
BSTR16 out=BSTR_AllocBytes(len+1);
if(!out)return 0;
if (!out)
return 0;
/*
* Copy the information in the buffer.
* Since it is valid to pass a NULL pointer here, we'll initialize the
* buffer to nul if it is the case.
*/
if (in != 0)
strcpy(BSTR_GetAddr(out),in);
else
memset(BSTR_GetAddr(out), 0, len+1);
return out;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment