contrib/elf2dmp: add kernel start address checking

Before this patch, if elf2dmp failed to find NT kernel PE magic in
allowed virtual address range, then it assumes NULL as NT kernel
address and cause segfault.

This patch fix the problem described above by checking NT kernel address
before futher processing.

Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Message-Id: <20190219211936.6466-1-viktor.prutyanov@phystech.edu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
master
Viktor Prutyanov 2019-02-20 00:19:36 +03:00 committed by Paolo Bonzini
parent d4cef0c67c
commit 06164cc402
1 changed files with 6 additions and 0 deletions

View File

@ -524,6 +524,12 @@ int main(int argc, char *argv[])
}
}
if (!nt_start_addr) {
eprintf("Failed to find NT kernel image\n");
err = 1;
goto out_ps;
}
printf("KernBase = 0x%016"PRIx64", signature is \'%.2s\'\n", KernBase,
(char *)nt_start_addr);