Author: ekohl
Date: Wed Jun 7 17:45:05 2017
New Revision: 74944
URL:
http://svn.reactos.org/svn/reactos?rev=74944&view=rev
Log:
[SCHEDSVC]
Avoid JOBs overrunning in LoadJobs().
- Define JOB_NAME_LENGTH and use it instead of hardcoded values.
Based on a patch by Victor Martinez Calvo.
CORE-13389
Modified:
trunk/reactos/base/services/schedsvc/job.c
trunk/reactos/base/services/schedsvc/precomp.h
Modified: trunk/reactos/base/services/schedsvc/job.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/schedsvc/job…
==============================================================================
--- trunk/reactos/base/services/schedsvc/job.c [iso-8859-1] (original)
+++ trunk/reactos/base/services/schedsvc/job.c [iso-8859-1] Wed Jun 7 17:45:05 2017
@@ -41,7 +41,7 @@
HKEY hJobsKey,
PWSTR pszJobName)
{
- WCHAR szNameBuffer[9];
+ WCHAR szNameBuffer[JOB_NAME_LENGTH];
FILETIME SystemTime;
ULONG ulSeed, ulValue;
HKEY hKey;
@@ -179,7 +179,7 @@
LoadJobs(VOID)
{
SCHEDULE Schedule;
- WCHAR szNameBuffer[32];
+ WCHAR szNameBuffer[JOB_NAME_LENGTH];
DWORD dwNameLength, dwIndex, dwSize;
HKEY hJobsKey = NULL, hJobKey = NULL;
PJOB pJob = NULL;
@@ -201,7 +201,7 @@
for (dwIndex = 0; dwIndex < 1000; dwIndex++)
{
- dwNameLength = 32;
+ dwNameLength = JOB_NAME_LENGTH;
lError = RegEnumKeyEx(hJobsKey,
dwIndex,
szNameBuffer,
Modified: trunk/reactos/base/services/schedsvc/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/schedsvc/pre…
==============================================================================
--- trunk/reactos/base/services/schedsvc/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/services/schedsvc/precomp.h [iso-8859-1] Wed Jun 7 17:45:05 2017
@@ -18,6 +18,8 @@
#include <wine/debug.h>
+#define JOB_NAME_LENGTH 9
+
NTSYSAPI
ULONG
NTAPI
@@ -30,7 +32,7 @@
LIST_ENTRY StartEntry;
ULARGE_INTEGER StartTime;
- WCHAR Name[9];
+ WCHAR Name[JOB_NAME_LENGTH];
DWORD JobId;
DWORD_PTR JobTime;