[FREELDR] xboxmem: Fix array out-of-bounds access (#1775)

Memory map array should be large enough to fit additional descriptors.

CORE-16216 CORE-16267
This commit is contained in:
Stanislav Motylkov 2019-08-07 13:06:37 +03:00 committed by Hermès BÉLUSCA - MAÏTO
parent 10c08e1d62
commit 2811d2f990
3 changed files with 4 additions and 3 deletions

View file

@ -35,8 +35,6 @@ DBG_DEFAULT_CHANNEL(MEMORY);
#define ULONGLONG_ALIGN_UP_BY(size, align) \
(ULONGLONG_ALIGN_DOWN_BY(((ULONGLONG)(size) + align - 1), align))
#define MAX_BIOS_DESCRIPTORS 80ul
BIOS_MEMORY_MAP PcBiosMemoryMap[MAX_BIOS_DESCRIPTORS];
ULONG PcBiosMapCount;

View file

@ -89,12 +89,13 @@ XboxMemInit(VOID)
AvailableMemoryMb = InstalledMemoryMb;
}
FREELDR_MEMORY_DESCRIPTOR XboxMemoryMap[2];
FREELDR_MEMORY_DESCRIPTOR XboxMemoryMap[MAX_BIOS_DESCRIPTORS + 1];
PFREELDR_MEMORY_DESCRIPTOR
XboxMemGetMemoryMap(ULONG *MemoryMapSize)
{
TRACE("XboxMemGetMemoryMap()\n");
/* FIXME: Obtain memory map via multiboot spec */
/* Synthesize memory map */

View file

@ -3,6 +3,8 @@
#ifndef __ASM__
#define MAX_BIOS_DESCRIPTORS 80
typedef enum
{
// ACPI 1.0.