Commit deebddf2 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

SysAllocStringLen16 needs to handle NULL pointers, too.

parent 7d6e1ea5
...@@ -105,8 +105,20 @@ INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR in) ...@@ -105,8 +105,20 @@ INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR in)
BSTR16 WINAPI SysAllocStringLen16(const char *in, int len) BSTR16 WINAPI SysAllocStringLen16(const char *in, int len)
{ {
BSTR16 out=BSTR_AllocBytes(len+1); 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); strcpy(BSTR_GetAddr(out),in);
else
memset(BSTR_GetAddr(out), 0, len+1);
return out; return out;
} }
......
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