From 13ae2f5b8c7bf3bd71c8a75250b39d1d77d7cc08 Mon Sep 17 00:00:00 2001 From: Francois Jacques Date: Mon, 10 Jul 2000 13:04:45 +0000 Subject: [PATCH] Prevent SysAllocString and SysAllocString16 to perform any processing on NULL strings. --- dlls/oleaut32/ole2disp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dlls/oleaut32/ole2disp.c b/dlls/oleaut32/ole2disp.c index ac608513365..66917faaa7a 100644 --- a/dlls/oleaut32/ole2disp.c +++ b/dlls/oleaut32/ole2disp.c @@ -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)); }