mirror of
https://github.com/reactos/reactos.git
synced 2025-05-08 11:24:14 +00:00
[DEVMGR] Avoid buffer overflow when device reg key size is > 100 chars
This commit is contained in:
parent
bbe47e61b1
commit
953c03c336
1 changed files with 5 additions and 3 deletions
|
@ -357,13 +357,15 @@ PVOID
|
||||||
GetResourceList(
|
GetResourceList(
|
||||||
LPWSTR pszDeviceID)
|
LPWSTR pszDeviceID)
|
||||||
{
|
{
|
||||||
WCHAR szBuffer[100];
|
|
||||||
PCM_RESOURCE_LIST pResourceList = NULL;
|
PCM_RESOURCE_LIST pResourceList = NULL;
|
||||||
HKEY hKey = NULL;
|
HKEY hKey = NULL;
|
||||||
DWORD dwError, dwSize;
|
DWORD dwError, dwSize;
|
||||||
|
|
||||||
wsprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Enum\\%s\\LogConf", pszDeviceID);
|
CStringW keyName = L"SYSTEM\\CurrentControlSet\\Enum\\";
|
||||||
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_READ, &hKey);
|
keyName += pszDeviceID;
|
||||||
|
keyName += L"\\LogConf";
|
||||||
|
|
||||||
|
dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyName, 0, KEY_READ, &hKey);
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
/* failed to open device instance log conf dir */
|
/* failed to open device instance log conf dir */
|
||||||
|
|
Loading…
Reference in a new issue