Commit a630b125 authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

winecoreaudio: Correctly handle devices whose UID contains non-ASCII characters.

parent 14a51fa4
...@@ -325,7 +325,12 @@ static NTSTATUS unix_get_endpoint_ids(void *args) ...@@ -325,7 +325,12 @@ static NTSTATUS unix_get_endpoint_ids(void *args)
for(i = 0; i < params->num; i++){ for(i = 0; i < params->num; i++){
const SIZE_T name_len = CFStringGetLength(info[i].name) + 1; const SIZE_T name_len = CFStringGetLength(info[i].name) + 1;
const SIZE_T device_len = CFStringGetLength(info[i].uid) + 1; CFIndex device_len;
CFStringGetBytes(info[i].uid, CFRangeMake(0, CFStringGetLength(info[i].uid)), kCFStringEncodingUTF8,
0, false, NULL, 0, &device_len);
device_len++; /* for null terminator */
needed += name_len * sizeof(WCHAR) + ((device_len + 1) & ~1); needed += name_len * sizeof(WCHAR) + ((device_len + 1) & ~1);
if(needed <= params->size){ if(needed <= params->size){
...@@ -336,7 +341,8 @@ static NTSTATUS unix_get_endpoint_ids(void *args) ...@@ -336,7 +341,8 @@ static NTSTATUS unix_get_endpoint_ids(void *args)
offset += name_len * sizeof(WCHAR); offset += name_len * sizeof(WCHAR);
endpoint->device = offset; endpoint->device = offset;
CFStringGetCString(info[i].uid, (char *)params->endpoints + offset, params->size - offset, kCFStringEncodingUTF8); CFStringGetBytes(info[i].uid, CFRangeMake(0, CFStringGetLength(info[i].uid)), kCFStringEncodingUTF8,
0, false, (UInt8 *)params->endpoints + offset, params->size - offset, NULL);
((char *)params->endpoints)[offset + device_len - 1] = '\0'; ((char *)params->endpoints)[offset + device_len - 1] = '\0';
offset += (device_len + 1) & ~1; offset += (device_len + 1) & ~1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment