Author: weiden
Date: Sun Jul 29 11:59:17 2007
New Revision: 27983
URL:
http://svn.reactos.org/svn/reactos?rev=27983&view=rev
Log:
Fix buffer overflow on unicode builds introduced in r27982
Modified:
trunk/reactos/dll/cpl/sysdm/virtmem.c
Modified: trunk/reactos/dll/cpl/sysdm/virtmem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/virtmem.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/virtmem.c (original)
+++ trunk/reactos/dll/cpl/sysdm/virtmem.c Sun Jul 29 11:59:17 2007
@@ -98,7 +98,7 @@
INT DriveLen;
INT PgCnt = 0;
- ZeroMemory(&szDrives, sizeof(szDrives) * sizeof(TCHAR));
+ ZeroMemory(szDrives, sizeof(szDrives));
DriveLen = GetLogicalDriveStrings(1023,
szDrives);
@@ -116,7 +116,7 @@
DrivePtr = _tcsupr(DrivePtr);
/* copy the 'X:' portion */
- lstrcpyn(szDrive, DrivePtr, 3);
+ lstrcpyn(szDrive, DrivePtr, sizeof(szDrive) / sizeof(TCHAR));
if(GetDriveType(DrivePtr) == DRIVE_FIXED)
{
@@ -247,8 +247,8 @@
static VOID
SetListBoxColumns(HWND hwndListBox)
{
- INT tabs[2] = {30, 170};
- SendMessage(hwndListBox, LB_SETTABSTOPS, (WPARAM)2, (LPARAM)(LPINT) &tabs[0]);
+ const INT tabs[2] = {30, 170};
+ SendMessage(hwndListBox, LB_SETTABSTOPS, (WPARAM)2, (LPARAM)&tabs[0]);
}