mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdump/dfi_vmcoreinfo: Sanity checks for n_namesz in ELF Notes header
The dfi_vmcoreinfo_init() function might be called on a dump of a non-ELF format because the DFI goes through all supported dump formats when first trying to identify of what dump format the given input is. Therefore, we must be very careful in interpreting read data and ensure that it makes sense before accessing or using it. This commit prevents a potential overflow of a stack buffer in dfi_vmcoreinfo_init() if note.n_namesz is bigger than the stack buffer. Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
01551f98d5
commit
686c331b69
@@ -94,6 +94,8 @@ void dfi_vmcoreinfo_init(void)
|
||||
return;
|
||||
if (dfi_mem_read_rc(addr, ¬e, sizeof(note)))
|
||||
return;
|
||||
if (note.n_namesz == 0 || note.n_namesz > sizeof(str))
|
||||
return;
|
||||
memset(str, 0, sizeof(str));
|
||||
if (dfi_mem_read_rc(addr + sizeof(note), str, note.n_namesz))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user