mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump/dfi_vmcoreinfo: Fix potential illegal memory access in os_info_get()
Before reading data in os_info_get(), check the validity of the memory range. Otherwise this can result in a segmentation fault when zgetdump is given a very small dump, e.g. S390 DASD single-volume dump of size 0x10 bytes. Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
@@ -62,7 +62,8 @@ static struct os_info *os_info_get(void)
|
||||
static struct os_info os_info;
|
||||
unsigned long addr;
|
||||
|
||||
dfi_mem_read(LC_OS_INFO, &addr, sizeof(addr));
|
||||
if (dfi_mem_read_rc(LC_OS_INFO, &addr, sizeof(addr)))
|
||||
return NULL;
|
||||
if (addr % 0x1000)
|
||||
return NULL;
|
||||
if (dfi_mem_read_rc(addr, &os_info, sizeof(os_info)))
|
||||
|
||||
Reference in New Issue
Block a user