mirror of
https://github.com/reactos/reactos.git
synced 2025-05-13 14:20:31 +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);
|
Status = MixerContext->QueryKeyValue(hKey, L"FriendlyName", (PVOID*)&Name, &Length, &Type);
|
||||||
if (Status == MM_STATUS_SUCCESS)
|
if (Status == MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
ASSERT(Length < MAXPNAMELEN);
|
// copy device name
|
||||||
wcscpy(MixerInfo->MixCaps.szPname, 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);
|
MixerContext->Free(Name);
|
||||||
|
|
||||||
|
// done
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,8 +658,13 @@ MMixerGetDeviceName(
|
||||||
Status = MixerContext->QueryKeyValue(hKey, L"FriendlyName", (PVOID*)&Name, &Length, &Type);
|
Status = MixerContext->QueryKeyValue(hKey, L"FriendlyName", (PVOID*)&Name, &Length, &Type);
|
||||||
if (Status == MM_STATUS_SUCCESS)
|
if (Status == MM_STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
ASSERT(Length < MAXPNAMELEN);
|
// copy device name
|
||||||
wcscpy(MixerInfo->MixCaps.szPname, 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);
|
MixerContext->Free(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue