- Add bounds checking for GetSystemMetrics both in user32 and in kernel counterpart.
- Based on a patch from bug 3316.
See issue #3316 for more details.
svn path=/trunk/; revision=33947
if (crOldCtrlText == CLR_INVALID)
{
crOldCtrlText = SetTextColor(hDC,
- infoPtr->Enabled ? MONTHCAL_CTRLFG : MONTHCAL_DISABLED_CTRLFG);
+ GetSysColor(infoPtr->Enabled ? MONTHCAL_CTRLFG : MONTHCAL_DISABLED_CTRLFG));
}
for (x = prcUpdate->left / infoPtr->CellSize.cx;
GetSystemMetrics(int nIndex)
{
// FIXME("Global Sever Data -> %x\n",g_psi);
- if (g_psi) return g_psi->SystemMetrics[nIndex];
+ if (nIndex < 0 || nIndex >= SM_CMETRICS) return 0;
+ if (g_psi)
+ return g_psi->SystemMetrics[nIndex];
else
- return(NtUserGetSystemMetrics(nIndex));
+ return(NtUserGetSystemMetrics(nIndex));
}
ULONG Width, Height, Result;
// DPRINT1("UserGetSystemMetrics -> %d\n",Index);
+
+ if (Index >= SM_CMETRICS)
+ {
+ DPRINT1("UserGetSystemMetrics() called with invalid index %d\n", Index);
+ return 0;
+ }
+
if (gpsi && Setup)
return gpsi->SystemMetrics[Index];
else