Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix computing sizeof_headers
Adding 1 to the size of this->data_directories_ and this->sections_ seems to be unnecessary. In this commit, the two '+1' are removed.
  • Loading branch information
Yuki Mogi committed Apr 13, 2021
1 parent 3b7b5a7 commit ab3f073
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PE/Binary.cpp
Expand Up @@ -549,8 +549,8 @@ uint32_t Binary::sizeof_headers(void) const {
size += sizeof(pe64_optional_header);
}

size += sizeof(pe_data_directory) * (this->data_directories_.size() + 1);
size += sizeof(pe_section) * (this->sections_.size() + 1);
size += sizeof(pe_data_directory) * (this->data_directories_.size());
size += sizeof(pe_section) * (this->sections_.size());
size = static_cast<uint32_t>(LIEF::align(size, this->optional_header().file_alignment()));
return size;

Expand Down

0 comments on commit ab3f073

Please sign in to comment.