mirror of
https://github.com/reactos/reactos.git
synced 2025-05-09 03:37:08 +00:00
[MMIXER]
- Fix buffer overflow - Dedicated to irc:igorko svn path=/trunk/; revision=47782
This commit is contained in:
parent
981690481a
commit
d6f80bd4d4
1 changed files with 16 additions and 4 deletions
|
@ -638,9 +638,16 @@ MMixerGetDeviceName(
|
|||
Status = MixerContext->QueryKeyValue(hKey, L"FriendlyName", (PVOID*)&Name, &Length, &Type);
|
||||
if (Status == MM_STATUS_SUCCESS)
|
||||
{
|
||||
ASSERT(Length < MAXPNAMELEN);
|
||||
wcscpy(MixerInfo->MixCaps.szPname, Name);
|
||||
// copy device name
|
||||
MixerContext->Copy(MixerInfo->MixCaps.szPname, Name, min(wcslen(Name), MAXPNAMELEN-1) * sizeof(WCHAR));
|
||||
|
||||
// make sure its null terminated
|
||||
MixerInfo->MixCaps.szPname[MAXPNAMELEN-1] = L'\0';
|
||||
|
||||
// free device name
|
||||
MixerContext->Free(Name);
|
||||
|
||||
// done
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -651,8 +658,13 @@ MMixerGetDeviceName(
|
|||
Status = MixerContext->QueryKeyValue(hKey, L"FriendlyName", (PVOID*)&Name, &Length, &Type);
|
||||
if (Status == MM_STATUS_SUCCESS)
|
||||
{
|
||||
ASSERT(Length < MAXPNAMELEN);
|
||||
wcscpy(MixerInfo->MixCaps.szPname, Name);
|
||||
// copy device name
|
||||
MixerContext->Copy(MixerInfo->MixCaps.szPname, Name, min(wcslen(Name), MAXPNAMELEN-1) * sizeof(WCHAR));
|
||||
|
||||
// make sure its null terminated
|
||||
MixerInfo->MixCaps.szPname[MAXPNAMELEN-1] = L'\0';
|
||||
|
||||
// free device name
|
||||
MixerContext->Free(Name);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue