Author: hbelusca Date: Fri Feb 27 01:39:49 2015 New Revision: 66475
URL: http://svn.reactos.org/svn/reactos?rev=66475&view=rev Log: [NTOS] - Check for command line validity in some places. - Correctly set the number of bitmap resources. Spotted by Thomas. CORE-6781
Modified: trunk/reactos/ntoskrnl/ex/init.c trunk/reactos/ntoskrnl/inbv/inbv.c
Modified: trunk/reactos/ntoskrnl/ex/init.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=6647... ============================================================================== --- trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] Fri Feb 27 01:39:49 2015 @@ -1377,13 +1377,13 @@ if (!HalInitSystem(1, LoaderBlock)) KeBugCheck(HAL1_INITIALIZATION_FAILED);
/* Get the command line and upcase it */ - CommandLine = _strupr(LoaderBlock->LoadOptions); + CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL);
/* Check if GUI Boot is enabled */ - NoGuiBoot = (strstr(CommandLine, "NOGUIBOOT")) ? TRUE: FALSE; + NoGuiBoot = (CommandLine && strstr(CommandLine, "NOGUIBOOT") != NULL);
/* Get the SOS setting */ - SosEnabled = strstr(CommandLine, "SOS") ? TRUE: FALSE; + SosEnabled = (CommandLine && strstr(CommandLine, "SOS") != NULL);
/* Setup the boot driver */ InbvEnableBootDriver(!NoGuiBoot); @@ -1406,11 +1406,11 @@ }
/* Check if this is LiveCD (WinPE) mode */ - if (strstr(CommandLine, "MININT")) + if (CommandLine && strstr(CommandLine, "MININT") != NULL) { /* Setup WinPE Settings */ InitIsWinPEMode = TRUE; - InitWinPEModeType |= (strstr(CommandLine, "INRAM")) ? 0x80000000 : 1; + InitWinPEModeType |= (strstr(CommandLine, "INRAM") != NULL) ? 0x80000000 : 0x00000001; }
/* Get the kernel's load entry */
Modified: trunk/reactos/ntoskrnl/inbv/inbv.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/inbv/inbv.c?rev=66... ============================================================================== --- trunk/reactos/ntoskrnl/inbv/inbv.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/inbv/inbv.c [iso-8859-1] Fri Feb 27 01:39:49 2015 @@ -40,8 +40,8 @@ static INBV_PROGRESS_STATE InbvProgressState; static BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0}; static INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters; -static ULONG ResourceCount; -static PUCHAR ResourceList[IDB_CLUSTER_SERVER + 1]; // The first entry in the table is the NULL pointer +static ULONG ResourceCount = 0; +static PUCHAR ResourceList[1 + IDB_CLUSTER_SERVER]; // First entry == NULL, followed by 'ResourceCount' entries.
#ifdef INBV_ROTBAR_IMPLEMENTED static BOOLEAN RotBarThreadActive = FALSE; @@ -174,14 +174,14 @@
VidBitBlt(PaletteBitmapBuffer, 0, 0);
- /* Wait for a bit. */ + /* Wait for a bit */ KeStallExecutionProcessor(PALETTE_FADE_TIME); }
/* Release the lock */ InbvReleaseLock();
- /* Wait for a bit. */ + /* Wait for a bit */ KeStallExecutionProcessor(PALETTE_FADE_TIME); } } @@ -271,8 +271,8 @@ if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED) { /* Check if we have a custom boot logo */ - CommandLine = _strupr(LoaderBlock->LoadOptions); - CustomLogo = strstr(CommandLine, "BOOTLOGO") ? TRUE: FALSE; + CommandLine = (LoaderBlock->LoadOptions ? _strupr(LoaderBlock->LoadOptions) : NULL); + CustomLogo = (CommandLine && strstr(CommandLine, "BOOTLOGO") != NULL); }
/* Initialize the video */ @@ -283,7 +283,7 @@ VidResetDisplay(CustomLogo);
/* Find bitmap resources in the kernel */ - ResourceCount = min(Count, RTL_NUMBER_OF(ResourceList)); + ResourceCount = min(Count, RTL_NUMBER_OF(ResourceList) - 1); for (i = 1; i <= ResourceCount; i++) { /* Do the lookup */