[MSCONFIG]
authorKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 22 Oct 2014 12:13:40 +0000 (12:13 +0000)
committerKamil Hornicek <kamil.hornicek@reactos.org>
Wed, 22 Oct 2014 12:13:40 +0000 (12:13 +0000)
- fix CID 503793 (unlikely NULL pointer dereference), 514558 (check return value)

svn path=/trunk/; revision=64884

reactos/base/applications/msconfig/srvpage.c
reactos/base/applications/msconfig/startuppage.c

index 4cfd62e..44870c0 100644 (file)
@@ -187,19 +187,16 @@ GetServices ( void )
                             return;
                         }
                     }
-                    if (pServiceFailureActions->cActions)
-                    {
-                        if (pServiceFailureActions->lpsaActions[0].Type == SC_ACTION_REBOOT)
-                        {
-                            LoadString(hInst, IDS_SERVICES_YES, szStatus, 128);
-                            item.pszText = szStatus;
-                            item.iSubItem = 1;
-                            SendMessage(hServicesListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
-                        }
-                    }
 
                     if (pServiceFailureActions != NULL)
                     {
+                        if (pServiceFailureActions->cActions && pServiceFailureActions->lpsaActions[0].Type == SC_ACTION_REBOOT)
+                        {
+                                LoadString(hInst, IDS_SERVICES_YES, szStatus, 128);
+                                item.pszText = szStatus;
+                                item.iSubItem = 1;
+                                SendMessage(hServicesListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
+                        }
                         HeapFree(GetProcessHeap(), 0, pServiceFailureActions);
                         pServiceFailureActions = NULL;
                     }
index 4d65a0f..e535893 100644 (file)
@@ -97,7 +97,11 @@ GetDisabledAutostartEntriesFromRegistry (TCHAR * szBasePath)
                 if (Data == NULL)
                     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);
                 memset(&item, 0, sizeof(LV_ITEM));
                 item.mask = LVIF_TEXT;