From 3536a8463ed2b6bd9ae1d4f7da3c99c02f13b1f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sun, 1 Feb 2015 15:10:19 +0000 Subject: [PATCH] [FREELDR]: Don't use a null pointer for strstr call. CORE-8198 #resolve #comment Fixed. svn path=/trunk/; revision=66141 --- .../boot/freeldr/freeldr/windows/headless.c | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/windows/headless.c b/reactos/boot/freeldr/freeldr/windows/headless.c index 4c0c3bf6782..76feab00f91 100644 --- a/reactos/boot/freeldr/freeldr/windows/headless.c +++ b/reactos/boot/freeldr/freeldr/windows/headless.c @@ -242,34 +242,33 @@ WinLdrInitializeHeadlessPort(VOID) VOID WinLdrSetupEms(IN PCHAR BootOptions) { - PCHAR RedirectPort; + PCHAR Settings; /* Start fresh */ RtlZeroMemory(&LoaderRedirectionInformation, sizeof(HEADLESS_LOADER_BLOCK)); LoaderRedirectionInformation.PciDeviceId = PCI_INVALID_VENDORID; /* Use a direction port if one was given, or use ACPI to detect one instead */ - RedirectPort = strstr(BootOptions, "/redirect="); - - if (RedirectPort) + Settings = strstr(BootOptions, "/redirect="); + if (Settings) { - RedirectPort = strstr(RedirectPort, "com"); + PCHAR RedirectPort = strstr(Settings, "com"); if (RedirectPort) { RedirectPort += sizeof("com") - 1; LoaderRedirectionInformation.PortNumber = atoi(RedirectPort); - LoaderRedirectionInformation.TerminalType = 1; //HeadlessSerialPort + LoaderRedirectionInformation.TerminalType = 1; // HeadlessSerialPort } else { - RedirectPort = strstr(RedirectPort, "usebiossettings"); - if (RedirectPort) + Settings = strstr(Settings, "usebiossettings"); + if (Settings) { UiDrawStatusText("ACPI SRT Table Not Supported..."); } else { - LoaderRedirectionInformation.PortAddress = (PUCHAR)strtoul(RedirectPort, 0, 16); + LoaderRedirectionInformation.PortAddress = (PUCHAR)strtoul(Settings, 0, 16); if (LoaderRedirectionInformation.PortAddress) { LoaderRedirectionInformation.PortNumber = 3; @@ -279,18 +278,18 @@ WinLdrSetupEms(IN PCHAR BootOptions) } /* Use a direction baudrate if one was given */ - RedirectPort = strstr(BootOptions, "/redirectbaudrate="); - if (RedirectPort) + Settings = strstr(BootOptions, "/redirectbaudrate="); + if (Settings) { - if (strstr(RedirectPort, "115200")) + if (strstr(Settings, "115200")) { LoaderRedirectionInformation.BaudRate = 115200; } - else if (strstr(RedirectPort, "57600")) + else if (strstr(Settings, "57600")) { LoaderRedirectionInformation.BaudRate = 57600; } - else if (strstr(RedirectPort, "19200")) + else if (strstr(Settings, "19200")) { LoaderRedirectionInformation.BaudRate = 19200; }