[FREELDR] Trivial improvements (#1757)
authorStanislav Motylkov <x86corez@gmail.com>
Sun, 28 Jul 2019 16:20:53 +0000 (19:20 +0300)
committerHermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
Sun, 28 Jul 2019 16:20:53 +0000 (18:20 +0200)
* [FREELDR] Fix uninitialized string in DiskGetBootPath()

CORE-16216 CORE-16248

* [FREELDR] xboxdisk: Add comment and fix code style

boot/freeldr/freeldr/arch/i386/xboxdisk.c
boot/freeldr/freeldr/disk/disk.c

index c63f066..9e31ce9 100644 (file)
@@ -30,6 +30,7 @@ DBG_DEFAULT_CHANNEL(DISK);
 #define XBOX_IDE_COMMAND_PORT 0x1f0
 #define XBOX_IDE_CONTROL_PORT 0x170
 
+/* BRFR signature at disk offset 0x600 */
 #define XBOX_SIGNATURE_SECTOR 3
 #define XBOX_SIGNATURE        ('B' | ('R' << 8) | ('F' << 16) | ('R' << 24))
 
@@ -479,7 +480,7 @@ XboxDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_T
      * This is the Xbox, chances are that there is a Xbox-standard
      * partitionless disk in it so let's check that first.
      */
-    if (1 <= PartitionNumber && PartitionNumber <= sizeof(XboxPartitions) / sizeof(XboxPartitions[0]) &&
+    if (PartitionNumber >= 1 && PartitionNumber <= sizeof(XboxPartitions) / sizeof(XboxPartitions[0]) &&
         MachDiskReadLogicalSectors(DriveNumber, XBOX_SIGNATURE_SECTOR, 1, SectorData))
     {
         if (*((PULONG) SectorData) == XBOX_SIGNATURE)
index 46da0be..5570120 100644 (file)
@@ -104,6 +104,9 @@ BOOLEAN DiskGetBootPath(OUT PCHAR BootPath, IN ULONG Size)
     if (*FrldrBootPath)
         goto Done;
 
+    if (Size)
+        BootPath[0] = ANSI_NULL;
+
     /* 0x49 is our magic ramdisk drive, so try to detect it first */
     if (FrldrBootDrive == 0x49)
     {