Author: janderwald
Date: Tue Sep 5 01:26:49 2006
New Revision: 23918
URL:
http://svn.reactos.org/svn/reactos?rev=23918&view=rev
Log:
* use ConsoleInfo struct directly
* change type in global struct (avoid buffer overflow when reading value from registry)
Modified:
trunk/reactos/dll/win32/console/console.c
trunk/reactos/dll/win32/console/console.h
Modified: trunk/reactos/dll/win32/console/console.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/console.…
==============================================================================
--- trunk/reactos/dll/win32/console/console.c (original)
+++ trunk/reactos/dll/win32/console/console.c Tue Sep 5 01:26:49 2006
@@ -192,14 +192,14 @@
else
{
/* use current info */
- PConsoleInfo pSharedInfo = MapViewOfFile((HANDLE)wParam,
- FILE_MAP_ALL_ACCESS,
- 0,
- 0,
- sizeof(ConsoleInfo));
-
- /* copy options */
- if (pSharedInfo)
+ PConsoleInfo pSharedInfo = (PConsoleInfo)wParam;
+
+ if (IsBadReadPtr((const void *)pSharedInfo, sizeof(ConsoleInfo)))
+ {
+ /* use defaults */
+ InitConsoleDefaults(pConInfo);
+ }
+ else
{
pConInfo->InsertMode = pSharedInfo->InsertMode;
pConInfo->HistoryBufferSize = pSharedInfo->HistoryBufferSize;
@@ -255,8 +255,6 @@
LPARAM lParam1,
LPARAM lParam2)
{
- int i = (int)lParam1;
-
switch(uMsg)
{
case CPL_INIT:
@@ -270,14 +268,14 @@
case CPL_INQUIRE:
{
CPLINFO *CPlInfo = (CPLINFO*)lParam2;
- CPlInfo->idIcon = Applets[i].idIcon;
- CPlInfo->idName = Applets[i].idName;
- CPlInfo->idInfo = Applets[i].idDescription;
+ CPlInfo->idIcon = Applets[0].idIcon;
+ CPlInfo->idName = Applets[0].idName;
+ CPlInfo->idInfo = Applets[0].idDescription;
break;
}
case CPL_DBLCLK:
{
- Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
+ Applets[0].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
break;
}
}
Modified: trunk/reactos/dll/win32/console/console.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/console/console.…
==============================================================================
--- trunk/reactos/dll/win32/console/console.h (original)
+++ trunk/reactos/dll/win32/console/console.h Tue Sep 5 01:26:49 2006
@@ -25,7 +25,7 @@
HWND hConsoleWindow;
TCHAR szProcessName[MAX_PATH];
BOOLEAN AppliedConfig;
- BOOLEAN UseRasterFonts;
+ DWORD UseRasterFonts;
DWORD FontSize;
DWORD FontWeight;
FONTSIGNATURE FontSignature;