=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: mshtml: Fix possible NULL pointer access in heap_str*.
Alexandre Julliard
julliard at winehq.org
Mon Nov 19 13:38:39 CST 2012
Module: wine
Branch: master
Commit: e9bfe83683266edcc2917e3d151254aefd4b070d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e9bfe83683266edcc2917e3d151254aefd4b070d
Author: André Hentschel <nerv at dawncrow.de>
Date: Sat Nov 17 22:52:32 2012 +0100
mshtml: Fix possible NULL pointer access in heap_str*.
---
dlls/mshtml/mshtml_private.h | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 6c7662e..f9c05f0 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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;
More information about the wine-cvs
mailing list