mercredi 17 janvier 2018

Address randomization in C

For various reasons I need to randomize an address in C, and then access to it. I just want to know which is the best way to achieve this. Up to now I worked up this solution.

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int generate_hex() {
        return rand();
}

int main(void) {
    srand(time(NULL));
    printf("%x\n", generate_hex());
}

But I don't know how to convert this hex string to an address to be accessed.




Aucun commentaire:

Enregistrer un commentaire