Commit e9bfe836 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

mshtml: Fix possible NULL pointer access in heap_str*.

parent 6804ae26
......@@ -1033,7 +1033,8 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
size = (strlenW(str)+1)*sizeof(WCHAR);
ret = heap_alloc(size);
memcpy(ret, str, size);
if(ret)
memcpy(ret, str, size);
}
return ret;
......@@ -1045,8 +1046,11 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, unsigned len)
if(str) {
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;
......@@ -1061,7 +1065,8 @@ static inline char *heap_strdupA(const char *str)
size = strlen(str)+1;
ret = heap_alloc(size);
memcpy(ret, str, size);
if(ret)
memcpy(ret, str, size);
}
return ret;
......@@ -1076,7 +1081,8 @@ static inline WCHAR *heap_strdupAtoW(const char *str)
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = heap_alloc(len*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
if(ret)
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
}
return ret;
......@@ -1089,7 +1095,8 @@ 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);
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
if(ret)
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
}
return ret;
......
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