[OSK] Validate the registry value data on query (#2050)

Ensure that the value data we query on loading the registry configuration settings matches with its data size
This commit is contained in:
Bișoc George 2019-11-18 21:25:51 +01:00 committed by Hermès BÉLUSCA - MAÏTO
parent 411a599610
commit 48d81f845d

View File

@ -16,7 +16,7 @@ BOOL LoadDataFromRegistry(VOID)
HKEY hKey;
LONG lResult;
DWORD dwValue;
DWORD cbData = sizeof(DWORD);
DWORD cbData = sizeof(dwValue);
/* Initialize the registry application settings */
Globals.bShowWarning = TRUE;
@ -49,7 +49,7 @@ BOOL LoadDataFromRegistry(VOID)
(BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
if (lResult != ERROR_SUCCESS || cbData != sizeof(dwValue))
{
/* Bail out and return FALSE if we fail */
RegCloseKey(hKey);
@ -67,7 +67,7 @@ BOOL LoadDataFromRegistry(VOID)
(BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
if (lResult != ERROR_SUCCESS || cbData != sizeof(dwValue))
{
/* Bail out and return FALSE if we fail */
RegCloseKey(hKey);
@ -85,7 +85,7 @@ BOOL LoadDataFromRegistry(VOID)
(BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
if (lResult != ERROR_SUCCESS || cbData != sizeof(dwValue))
{
/* Bail out and return FALSE if we fail */
RegCloseKey(hKey);
@ -103,7 +103,7 @@ BOOL LoadDataFromRegistry(VOID)
(BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
if (lResult != ERROR_SUCCESS || cbData != sizeof(dwValue))
{
/* Bail out and return FALSE if we fail */
RegCloseKey(hKey);
@ -120,7 +120,7 @@ BOOL LoadDataFromRegistry(VOID)
(BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
if (lResult != ERROR_SUCCESS || cbData != sizeof(dwValue))
{
/* Bail out and return FALSE if we fail */
RegCloseKey(hKey);
@ -137,7 +137,7 @@ BOOL LoadDataFromRegistry(VOID)
(BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
if (lResult != ERROR_SUCCESS || cbData != sizeof(dwValue))
{
/* Bail out and return FALSE if we fail */
RegCloseKey(hKey);