MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / VerifyELF

Function VerifyELF

Kernel/src/arch/x86_64/elf.cpp:11–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9#include <math.h>
10
11int VerifyELF(void* elf){
12 elf64_header_t elfHdr = *(elf64_header_t*)elf;
13
14 char id[4];
15 strncpy(id, (char*)elfHdr.id + 1, 3);
16 if(strncmp("ELF", id, 3)){
17 Log::Warning("Invalid ELF Header: %x, %x, %x (%c%c%c)", id[0], id[1], id[2], id[0], id[1], id[2]);
18 return 0;
19 } else return 1;
20}
21
22elf_info_t LoadELFSegments(process_t* proc, void* _elf, uintptr_t base){
23 uint8_t* elf = reinterpret_cast<uint8_t*>(_elf);

Callers 2

LoadELFSegmentsFunction · 0.85
CreateELFProcessFunction · 0.85

Calls 3

strncpyFunction · 0.85
strncmpFunction · 0.85
WarningFunction · 0.85

Tested by

no test coverage detected