dwrite: Fix possible NULL pointer access in heap_strdup*.

This commit is contained in:
André Hentschel 2012-11-17 22:52:26 +01:00 committed by Alexandre Julliard
parent bafe54e7e5
commit 7e2cac2602
1 changed files with 7 additions and 3 deletions

View File

@ -47,7 +47,8 @@ static inline LPWSTR heap_strdupW(const WCHAR *str)
size = (strlenW(str)+1)*sizeof(WCHAR);
ret = heap_alloc(size);
memcpy(ret, str, size);
if(ret)
memcpy(ret, str, size);
}
return ret;
@ -60,8 +61,11 @@ static inline LPWSTR heap_strdupnW(const WCHAR *str, UINT32 len)
if (len)
{
ret = heap_alloc((len+1)*sizeof(WCHAR));
memcpy(ret, str, len*sizeof(WCHAR));
ret[len] = 0;
if(ret)
{
memcpy(ret, str, len*sizeof(WCHAR));
ret[len] = 0;
}
}
return ret;