Merge branch 'master' into master

This commit is contained in:
red031000
2020-05-27 15:32:57 +01:00
committed by GitHub
2 changed files with 9 additions and 4 deletions

View File

@@ -33,4 +33,4 @@ notifications:
email: false
after_success:
- .travis/calcrom/webhook.sh
- .travis/calcrom/webhook.sh pokediamond

View File

@@ -11,10 +11,12 @@
* - Must be placed in ".travis/calcrom/".
*
* Changelog:
* - 1.0.0 (26 May 2020):
* - 0.1.0 (26 May 2020):
* Initial implementation
* - 1.0.1 (26 May 2020):
* - 0.1.1 (26 May 2020):
* Allow program to be run from wherever
* 0.1.2 (27 May 2020):
* Extra security on ELF header
*/
#include <iostream>
@@ -74,7 +76,10 @@ int main(int argc, char ** argv)
fname_s = fname_s.replace(fname_s.rfind('.'), 4, ".o");
elf.open(fname_s, ios_base::in | ios_base::binary);
elf.read((char *)&ehdr, sizeof(ehdr));
if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0) {
if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0
|| ehdr.e_ehsize != sizeof(Elf32_Ehdr)
|| ehdr.e_shentsize != sizeof(Elf32_Shdr))
{
elf.close();
stringstream ss;
ss << "Error validating " << fname_s << " as an ELF file" << endl;