Module: wine Branch: master Commit: 594de90ccd870d148d4679ebae18f5bca0f07fb0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=594de90ccd870d148d4679ebae...
Author: William Waghorn willw@litany.me.uk Date: Sat Mar 20 14:37:26 2010 -0700
dsound: Ensure device name and description buffers are NUL terminated.
---
dlls/dsound/dsound_main.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c index ee1d43b..8e264c7 100644 --- a/dlls/dsound/dsound_main.c +++ b/dlls/dsound/dsound_main.c @@ -378,8 +378,12 @@ HRESULT WINAPI DirectSoundEnumerateW( debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDesc, sizeof(wDesc)/sizeof(WCHAR) ); + wDesc[(sizeof(wDesc)/sizeof(WCHAR)) - 1] = '\0'; + MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wName, sizeof(wName)/sizeof(WCHAR) ); + wName[(sizeof(wName)/sizeof(WCHAR)) - 1] = '\0'; + if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], wDesc, wName, lpContext) == FALSE) return DS_OK; } @@ -462,6 +466,8 @@ DirectSoundCaptureEnumerateW( wDesc, sizeof(wDesc)/sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wName, sizeof(wName)/sizeof(WCHAR) ); + wName[(sizeof(wName)/sizeof(WCHAR)) - 1] = '\0'; + if (lpDSEnumCallback(NULL, wDesc, wName, lpContext) == FALSE) return DS_OK; } @@ -477,8 +483,12 @@ DirectSoundCaptureEnumerateW( debugstr_guid(&DSOUND_capture_guids[wid]),desc.szDesc,desc.szDrvname,lpContext); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDesc, sizeof(wDesc)/sizeof(WCHAR) ); + wDesc[(sizeof(wDesc)/sizeof(WCHAR)) - 1] = '\0'; + MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wName, sizeof(wName)/sizeof(WCHAR) ); + wName[(sizeof(wName)/sizeof(WCHAR)) - 1] = '\0'; + if (lpDSEnumCallback(&DSOUND_capture_guids[wid], wDesc, wName, lpContext) == FALSE) return DS_OK; }