fix: "clean" jump, can modify payload
This commit is contained in:
parent
621a1ec641
commit
c04078e5a2
|
@ -1,6 +1,5 @@
|
|||
#include "../includes/woody.h"
|
||||
|
||||
|
||||
int elf_magic_numbers(char *str)
|
||||
{
|
||||
return (!ft_strncmp(str, ELFMAG, SELFMAG));
|
||||
|
@ -99,8 +98,7 @@ int insert_payload(t_elf_content *woody, t_payload *payload, size_t payload_posi
|
|||
if (ptr)
|
||||
{
|
||||
int32_t jmp_index = ptr - payload->payload;
|
||||
int32_t jump_value = ((payload_position + payload->len) - woody->Ehdr->e_entry) * -1;
|
||||
jump_value += 14;
|
||||
int32_t jump_value = ((payload_position + jmp_index + 5) - woody->Ehdr->e_entry) * -1; // 5 = JUMP SIZE (OPCODE + 4 bytes operand)
|
||||
|
||||
ft_memcpy(&payload->payload[jmp_index + 1], &jump_value, sizeof(jump_value));
|
||||
ft_memcpy(woody->file + payload_position, payload->payload, payload->len);
|
||||
|
|
Loading…
Reference in New Issue