Skip to content

Commit

Permalink
Fix hashsum calculation, mk. 2
Browse files Browse the repository at this point in the history
Also need to skip .upd_info section.
  • Loading branch information
TheAssassin committed Jul 19, 2018
1 parent 1bdf706 commit 00c2bff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,17 @@ namespace appimage {
// read offset and length of signature section to skip it later
unsigned long sigOffset = 0, sigLength = 0;
unsigned long keyOffset = 0, keyLength = 0;
unsigned long updInfoOffset = 0, updInfoLength = 0;

if (!appimage_get_elf_section_offset_and_length(pathToAppImage.c_str(), ".sha256_sig", &sigOffset, &sigLength))
return "";

if (!appimage_get_elf_section_offset_and_length(pathToAppImage.c_str(), ".sig_key", &keyOffset, &keyLength))
return "";

if (!appimage_get_elf_section_offset_and_length(pathToAppImage.c_str(), ".upd_info", &updInfoOffset, &updInfoLength))
return "";

std::ifstream ifs(pathToAppImage);

if (!ifs)
Expand Down Expand Up @@ -187,6 +191,7 @@ namespace appimage {
// are, skip those sections in the current and future sections
checkSkipSection(sigOffset, sigLength);
checkSkipSection(keyOffset, keyLength);
checkSkipSection(updInfoOffset, updInfoLength);

// read remaining bytes in chunk, given the file has still data to be read
if (ifs && bytesLeftInChunk > 0) {
Expand Down

0 comments on commit 00c2bff

Please sign in to comment.