[MSCONFIG]

- fix CID 503793 (unlikely NULL pointer dereference), 514558 (check return value)

svn path=/trunk/; revision=64884
This commit is contained in:
Kamil Hornicek 2014-10-22 12:13:40 +00:00
parent 27938d24c5
commit a48fe43631
2 changed files with 12 additions and 11 deletions

View file

@ -187,19 +187,16 @@ GetServices ( void )
return; return;
} }
} }
if (pServiceFailureActions->cActions)
if (pServiceFailureActions != NULL)
{ {
if (pServiceFailureActions->lpsaActions[0].Type == SC_ACTION_REBOOT) if (pServiceFailureActions->cActions && pServiceFailureActions->lpsaActions[0].Type == SC_ACTION_REBOOT)
{ {
LoadString(hInst, IDS_SERVICES_YES, szStatus, 128); LoadString(hInst, IDS_SERVICES_YES, szStatus, 128);
item.pszText = szStatus; item.pszText = szStatus;
item.iSubItem = 1; item.iSubItem = 1;
SendMessage(hServicesListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); SendMessage(hServicesListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
} }
}
if (pServiceFailureActions != NULL)
{
HeapFree(GetProcessHeap(), 0, pServiceFailureActions); HeapFree(GetProcessHeap(), 0, pServiceFailureActions);
pServiceFailureActions = NULL; pServiceFailureActions = NULL;
} }

View file

@ -97,7 +97,11 @@ GetDisabledAutostartEntriesFromRegistry (TCHAR * szBasePath)
if (Data == NULL) if (Data == NULL)
break; break;
RegEnumKeyEx(hKey, Index, szValueName, &dwValueLength, NULL, NULL, NULL, NULL); if(RegEnumKeyEx(hKey, Index, szValueName, &dwValueLength, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
{
HeapFree(GetProcessHeap(), 0, Data);
continue;
}
_stprintf(szSubPath, _T("%s\\%s"), szBasePath, szValueName); _stprintf(szSubPath, _T("%s\\%s"), szBasePath, szValueName);
memset(&item, 0, sizeof(LV_ITEM)); memset(&item, 0, sizeof(LV_ITEM));
item.mask = LVIF_TEXT; item.mask = LVIF_TEXT;