[TASKMGR]

- fix CIDs 731628 (unlikely buffer overrun), 500038 (dead code), 1101977 (unchecked return value)

svn path=/trunk/; revision=64890
This commit is contained in:
Kamil Hornicek 2014-10-22 16:01:24 +00:00
parent 6256673633
commit 6f16539c0c
4 changed files with 17 additions and 15 deletions

View file

@ -204,10 +204,13 @@ void UpdateColumnDataHints(void)
HDITEM hditem; HDITEM hditem;
WCHAR text[260]; WCHAR text[260];
ULONG Index; ULONG Index;
ULONG uItems;
WCHAR szTemp[256]; WCHAR szTemp[256];
unsigned int i; UINT i;
for (Index=0; Index<(ULONG)SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0); Index++) uItems = min(SendMessageW(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0), COLUMN_NMAX);
for (Index=0; Index<uItems; Index++)
{ {
memset(&hditem, 0, sizeof(HDITEM)); memset(&hditem, 0, sizeof(HDITEM));

View file

@ -120,17 +120,15 @@ void GraphCtrl_Dispose(TGraphCtrl* this)
if (this->m_brushBack != NULL) DeleteObject(this->m_brushBack); if (this->m_brushBack != NULL) DeleteObject(this->m_brushBack);
} }
BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID) void GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
{ {
BOOL result = 0;
GraphCtrl_Init(this); GraphCtrl_Init(this);
this->m_hParentWnd = hParentWnd; this->m_hParentWnd = hParentWnd;
this->m_hWnd = hWnd; this->m_hWnd = hWnd;
GraphCtrl_Resize(this); GraphCtrl_Resize(this);
if (result != 0)
GraphCtrl_InvalidateCtrl(this, FALSE); return;
return result;
} }
void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double dUpper, int nDecimalPlaces) void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double dUpper, int nDecimalPlaces)

View file

@ -88,7 +88,7 @@ extern WNDPROC OldGraphCtrlWndProc;
double GraphCtrl_AppendPoint(TGraphCtrl* this, double GraphCtrl_AppendPoint(TGraphCtrl* this,
double dNewPoint0, double dNewPoint1, double dNewPoint0, double dNewPoint1,
double dNewPoint2, double dNewPoint3); double dNewPoint2, double dNewPoint3);
BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, void GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd,
UINT nID); UINT nID);
void GraphCtrl_Dispose(TGraphCtrl* this); void GraphCtrl_Dispose(TGraphCtrl* this);
void GraphCtrl_DrawPoint(TGraphCtrl* this); void GraphCtrl_DrawPoint(TGraphCtrl* this);

View file

@ -154,13 +154,14 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
/* Get a token for this process. */ /* Get a token for this process. */
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) { if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) {
/* Get the LUID for the debug privilege. */ /* Get the LUID for the debug privilege. */
LookupPrivilegeValueW(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid); if(LookupPrivilegeValueW(NULL, SE_DEBUG_NAME, &tkp.Privileges[0].Luid))
{
tkp.PrivilegeCount = 1; /* one privilege to set */
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
tkp.PrivilegeCount = 1; /* one privilege to set */ /* Get the debug privilege for this process. */
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
}
/* Get the debug privilege for this process. */
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
CloseHandle(hToken); CloseHandle(hToken);
} }