Henri Verbeet : mmdevapi: Include space for the terminating zero in info_device_ps_GetValue().

Alexandre Julliard julliard at winehq.org
Fri Sep 2 13:13:36 CDT 2011


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Sep  1 21:54:53 2011 +0200

mmdevapi: Include space for the terminating zero in info_device_ps_GetValue().

---

 dlls/mmdevapi/devenum.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c
index 0cb471b..2f6c809 100644
--- a/dlls/mmdevapi/devenum.c
+++ b/dlls/mmdevapi/devenum.c
@@ -1246,11 +1246,12 @@ static HRESULT WINAPI info_device_ps_GetValue(IPropertyStore *iface,
 
     if (IsEqualPropertyKey(*key, DEVPKEY_Device_Driver))
     {
+        INT size = (lstrlenW(drvs.module_name) + 1) * sizeof(WCHAR);
         pv->vt = VT_LPWSTR;
-        pv->u.pwszVal = CoTaskMemAlloc(lstrlenW(drvs.module_name) * sizeof(WCHAR));
+        pv->u.pwszVal = CoTaskMemAlloc(size);
         if (!pv->u.pwszVal)
             return E_OUTOFMEMORY;
-        lstrcpyW(pv->u.pwszVal, drvs.module_name);
+        memcpy(pv->u.pwszVal, drvs.module_name, size);
         return S_OK;
     }
 




More information about the wine-cvs mailing list