Misha Koshelev : msi/tests: automation: Check for NULL source string before calling lstrcpyW.

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 18 08:04:03 CDT 2007


Module: wine
Branch: master
Commit: 63ed9117c3d749ad4d3ce954fdaa3e0183d76c6d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=63ed9117c3d749ad4d3ce954fdaa3e0183d76c6d

Author: Misha Koshelev <mk144210 at bcm.edu>
Date:   Thu May 17 11:35:48 2007 -0500

msi/tests: automation: Check for NULL source string before calling lstrcpyW.

---

 dlls/msi/tests/automation.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c
index aa92b05..33d3118 100644
--- a/dlls/msi/tests/automation.c
+++ b/dlls/msi/tests/automation.c
@@ -684,7 +684,7 @@ static HRESULT Installer_RegistryValueW(HKEY hkey, LPCWSTR szKey, LPCWSTR szValu
     V_BSTR(&vararg) = SysAllocString(szValue);
 
     hr = Installer_RegistryValue(hkey, szKey, vararg, &varresult, VT_BSTR);
-    lstrcpyW(szString, V_BSTR(&varresult));
+    if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
     VariantClear(&varresult);
     return hr;
 }
@@ -811,7 +811,7 @@ static HRESULT Installer_VersionGet(LPWSTR szVersion)
     HRESULT hr;
 
     hr = invoke(pInstaller, "Version", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
-    lstrcpyW(szVersion, V_BSTR(&varresult));
+    if (V_BSTR(&varresult)) lstrcpyW(szVersion, V_BSTR(&varresult));
     VariantClear(&varresult);
     return hr;
 }
@@ -839,7 +839,7 @@ static HRESULT Session_PropertyGet(IDispatch *pSession, LPCWSTR szName, LPWSTR s
     V_BSTR(&vararg[0]) = SysAllocString(szName);
 
     hr = invoke(pSession, "Property", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
-    lstrcpyW(szReturn, V_BSTR(&varresult));
+    if (V_BSTR(&varresult)) lstrcpyW(szReturn, V_BSTR(&varresult));
     VariantClear(&varresult);
     return hr;
 }
@@ -1101,7 +1101,7 @@ static HRESULT Record_StringDataGet(IDispatch *pRecord, int iField, LPWSTR szStr
     V_I4(&vararg[0]) = iField;
 
     hr = invoke(pRecord, "StringData", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
-    lstrcpyW(szString, V_BSTR(&varresult));
+    if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
     VariantClear(&varresult);
     return hr;
 }
@@ -1169,7 +1169,7 @@ static HRESULT StringList_Item(IDispatch *pStringList, int iIndex, LPWSTR szStri
     V_I4(&vararg[0]) = iIndex;
 
     hr = invoke(pStringList, "Item", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
-    lstrcpyW(szString, V_BSTR(&varresult));
+    if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
     VariantClear(&varresult);
     return hr;
 }




More information about the wine-cvs mailing list