Could the own heap space be readed? could the software be self modified in memory?
I write some code to show the subject,
am I reading own code at memory? how (if possible) to write it and change instruction on runtime?
#include<stdio.h>
#include<stdint.h>
volatile int addressBase;
uint8_t read(int address);
int main(void) {
printf("Helium word");
addressBase=(int)&main;
printf("[%X]", read( 0 ));
getchar();
return 0;
}
uint8_t read(int address)
{
const uint8_t *addr;
addr=(const unsigned char *)(addressBase+(int)address);
return (*addr);
}