diff --git a/reactos/base/system/winlogon/screensaver.c b/reactos/base/system/winlogon/screensaver.c index 635651b5a6c..17423e58f37 100644 --- a/reactos/base/system/winlogon/screensaver.c +++ b/reactos/base/system/winlogon/screensaver.c @@ -243,7 +243,7 @@ StartScreenSaver( HKEY hKey = NULL; WCHAR szApplicationName[MAX_PATH]; WCHAR szCommandLine[MAX_PATH + 3]; - DWORD bufferSize = (sizeof(szApplicationName) / sizeof(WCHAR)) - 1; + DWORD bufferSize = sizeof(szApplicationName) - sizeof(WCHAR); DWORD dwType; STARTUPINFOW StartupInfo; PROCESS_INFORMATION ProcessInformation; @@ -280,7 +280,7 @@ StartScreenSaver( if (bufferSize == 0) goto cleanup; - szApplicationName[bufferSize] = 0; /* Terminate the string */ + szApplicationName[bufferSize / sizeof(WCHAR)] = 0; /* Terminate the string */ if (wcslen(szApplicationName) == 0) goto cleanup;