title: Checking if an ELF file is truncated
body: <p>I am trying to get the size of a file using the elf informations to check if the file is not truncated.
  What I am dooing right now is comparing the size of the file using <code>lseek(fd, 0, SEEK_END)</code> with the size of <code>(all sections + elf-&gt;e_ehsize + (elf-&gt;e_phnum * elf-&gt;e_phentsize) + (elf-&gt;e_shnum * elf-&gt;e_shentsize))</code> but, this doesn't seem correct. Do you guys have any idea on how to know if the elf file is truncated ?</p>
  
  <p>edit: i am only allowed to use the glibc</p>