- Fix reading past the end of the pool block.

svn path=/trunk/; revision=8747
This commit is contained in:
David Welch 2004-03-15 19:06:35 +00:00
parent 94683a5682
commit 60a43e438d

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: keyboard.c,v 1.26 2004/03/11 16:17:25 weiden Exp $ /* $Id: keyboard.c,v 1.27 2004/03/15 19:06:35 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -541,9 +541,10 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
RtlFreeUnicodeString(&LayoutFile); RtlFreeUnicodeString(&LayoutFile);
KeyboardLayoutWSTR = ExAllocatePoolWithTag(PagedPool, KeyboardLayoutWSTR =
(FullLayoutPath.Length + 1) * ExAllocatePoolWithTag(PagedPool,
sizeof(WCHAR), TAG_STRING); FullLayoutPath.Length + sizeof(WCHAR),
TAG_STRING);
if( !KeyboardLayoutWSTR ) { if( !KeyboardLayoutWSTR ) {
DPRINT1("Couldn't allocate a string for the keyboard layout name.\n"); DPRINT1("Couldn't allocate a string for the keyboard layout name.\n");
@ -551,8 +552,8 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
return; return;
} }
memcpy(KeyboardLayoutWSTR,FullLayoutPath.Buffer, memcpy(KeyboardLayoutWSTR,FullLayoutPath.Buffer,
(FullLayoutPath.Length + 1) * sizeof(WCHAR)); FullLayoutPath.Length + sizeof(WCHAR));
KeyboardLayoutWSTR[FullLayoutPath.Length] = 0; KeyboardLayoutWSTR[FullLayoutPath.Length / sizeof(WCHAR)] = 0;
kbModule = EngLoadImage(KeyboardLayoutWSTR); kbModule = EngLoadImage(KeyboardLayoutWSTR);
DPRINT( "Load Keyboard Layout: %S\n", KeyboardLayoutWSTR ); DPRINT( "Load Keyboard Layout: %S\n", KeyboardLayoutWSTR );