Browse Source

Error out if no object file header

Quit the program if object file header can't be read or is smaller than
expected.
master
Thomas Preud'homme 10 years ago
parent
commit
8a440f169b
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      pstack.c

+ 6
- 1
pstack.c View File

@ -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…
Cancel
Save