Prevent SysAllocString and SysAllocString16 to perform any processing

on NULL strings.
This commit is contained in:
Francois Jacques 2000-07-10 13:04:45 +00:00 committed by Alexandre Julliard
parent 5c13c2189e
commit 13ae2f5b8c
1 changed files with 7 additions and 1 deletions

View File

@ -50,7 +50,11 @@ static void* BSTR_GetAddr(BSTR16 in)
*/
BSTR16 WINAPI SysAllocString16(LPCOLESTR16 in)
{
BSTR16 out=BSTR_AllocBytes(strlen(in)+1);
BSTR16 out;
if (!in) return 0;
out = BSTR_AllocBytes(strlen(in)+1);
if(!out)return 0;
strcpy(BSTR_GetAddr(out),in);
return out;
@ -61,6 +65,8 @@ BSTR16 WINAPI SysAllocString16(LPCOLESTR16 in)
*/
BSTR WINAPI SysAllocString(LPCOLESTR in)
{
if (!in) return 0;
/* Delegate this to the SysAllocStringLen32 method. */
return SysAllocStringLen(in, lstrlenW(in));
}