Hardened registry read in settings
This commit is contained in:
parent
5f8ab14f3f
commit
e6877e8135
@ -64,9 +64,9 @@ static BOOL settings_reg_query_dword_val(HKEY hKey, const TCHAR* sub, DWORD* val
|
||||
|
||||
dwSize = sizeof(DWORD);
|
||||
if (RegQueryValueEx(hKey, sub, NULL, &dwType, (BYTE*)value, &dwSize) != ERROR_SUCCESS)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (dwType != REG_DWORD)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -78,6 +78,9 @@ static BOOL settings_reg_query_word_val(HKEY hKey, const TCHAR* sub, UINT16* val
|
||||
if (!settings_reg_query_dword_val(hKey, sub, &dwValue))
|
||||
return FALSE;
|
||||
|
||||
if (dwValue > UINT16_MAX)
|
||||
return FALSE;
|
||||
|
||||
*value = (UINT16)dwValue;
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user