Huw Davies (@huw) commented about dlls/mmdevapi/devenum.c:
PropVariantClear(&pv2); }
- MMDevice_SetPropValue(id, flow, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pv); MMDevice_SetPropValue(id, flow, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_FriendlyName, &pv); + + pv.pwszVal = type = (WCHAR *)(flow == eCapture ? L"Microphone" : L"Speakers"); MMDevice_SetPropValue(id, flow, (const PROPERTYKEY*)&DEVPKEY_Device_DeviceDesc, &pv);
+ len = (wcslen(type) + wcslen(cur->drv_id) + wcslen(L" ()") + 1) * sizeof(WCHAR); + pv.vt = VT_LPWSTR; + pv.pwszVal = CoTaskMemAlloc(len); + swprintf(pv.pwszVal, len, L"%ls (%ls)", type, cur->drv_id);
The second param of `swprintf` should be `len/2`. Better yet, keep `len` to be lengths and just multiply by `sizeof(WCHAR)` in the allocation. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9915#note_129015