Sync with trunk head.
[reactos.git] / base / system / winlogon / screensaver.c
index 43737db..17423e5 100644 (file)
@@ -243,7 +243,7 @@ StartScreenSaver(
        HKEY hKey = NULL;
        WCHAR szApplicationName[MAX_PATH];
        WCHAR szCommandLine[MAX_PATH + 3];
        HKEY hKey = NULL;
        WCHAR szApplicationName[MAX_PATH];
        WCHAR szCommandLine[MAX_PATH + 3];
-       DWORD bufferSize = sizeof(szApplicationName)- 1;
+       DWORD bufferSize = sizeof(szApplicationName) - sizeof(WCHAR);
        DWORD dwType;
        STARTUPINFOW StartupInfo;
        PROCESS_INFORMATION ProcessInformation;
        DWORD dwType;
        STARTUPINFOW StartupInfo;
        PROCESS_INFORMATION ProcessInformation;
@@ -280,7 +280,7 @@ StartScreenSaver(
        if (bufferSize == 0)
                goto cleanup;
 
        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;
 
        if (wcslen(szApplicationName) == 0)
                goto cleanup;