Error out if no object file header
Quit the program if object file header can't be read or is smaller than expected.
This commit is contained in:
parent
a8f2e34c5f
commit
8a440f169b
7
pstack.c
7
pstack.c
|
@ -488,7 +488,12 @@ static Symbols loadSyms(const char *fname)
|
|||
perror("opening object file");
|
||||
quit("Could not open object file.");
|
||||
}
|
||||
read(fd, &hdr, sizeof(hdr));
|
||||
if (read(fd, &hdr, sizeof(hdr)) < (int) sizeof(hdr))
|
||||
{
|
||||
fprintf(stderr, "'%s': ", fname);
|
||||
perror("reading object file ELF header");
|
||||
quit("Could not read object file ELF header.");
|
||||
}
|
||||
verify_ident(&hdr);
|
||||
if (!find_stables(&hdr, fd, syms)) {
|
||||
deleteSyms(syms);
|
||||
|
|
Loading…
Reference in New Issue