[ros-diffs] [arty] 36424: Didn't notice that bufferSize is used by RegQueryValueEx. Now we count in bytes with bufferSize and count in chars just in the subscript. Noticed by Christoph_Vw

arty at svn.reactos.org arty at svn.reactos.org
Tue Sep 23 12:17:28 CEST 2008


Author: arty
Date: Tue Sep 23 05:17:27 2008
New Revision: 36424

URL: http://svn.reactos.org/svn/reactos?rev=36424&view=rev
Log:
Didn't notice that bufferSize is used by RegQueryValueEx.  Now we count in
bytes with bufferSize and count in chars just in the subscript.

Noticed by Christoph_Vw

Modified:
    trunk/reactos/base/system/winlogon/screensaver.c

Modified: trunk/reactos/base/system/winlogon/screensaver.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/screensaver.c?rev=36424&r1=36423&r2=36424&view=diff
==============================================================================
--- trunk/reactos/base/system/winlogon/screensaver.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/screensaver.c [iso-8859-1] Tue Sep 23 05:17:27 2008
@@ -243,7 +243,7 @@
 	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 @@
 	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;



More information about the Ros-diffs mailing list