mshtml: Fix possible NULL pointer access in heap_str*.

This commit is contained in:
André Hentschel 2012-11-17 22:52:32 +01:00 committed by Alexandre Julliard
parent 6804ae26fb
commit e9bfe83683
1 changed files with 13 additions and 6 deletions

View File

@ -1033,6 +1033,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
size = (strlenW(str)+1)*sizeof(WCHAR);
ret = heap_alloc(size);
if(ret)
memcpy(ret, str, size);
}
@ -1045,9 +1046,12 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
if(str) {
ret = heap_alloc((len+1)*sizeof(WCHAR));
if(ret)
{
memcpy(ret, str, len*sizeof(WCHAR));
ret[len] = 0;
}
}
return ret;
}
@ -1061,6 +1065,7 @@ static inline char *heap_strdupA(const char *str)
size = strlen(str)+1;
ret = heap_alloc(size);
if(ret)
memcpy(ret, str, size);
}
@ -1076,6 +1081,7 @@ static inline WCHAR *heap_strdupAtoW(const char *str)
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = heap_alloc(len*sizeof(WCHAR));
if(ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
}
@ -1089,6 +1095,7 @@ static inline char *heap_strdupWtoA(LPCWSTR str)
if(str) {
DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
ret = heap_alloc(size);
if(ret)
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
}