mirror of
https://github.com/Gallopsled/pwntools.git
synced 2026-10-12 02:02:27 +00:00
* feat(fmtstr): place pointers after format operations This means that the format string can now also work in certain cases even if the pointers contain null bytes. That's especially important on 64 bit where most pointers contain null bytes. * fix(fmtstr): more stuff * feat(fmtstr): optimize * perf(fmtstr): make sorting run in reasonable time (not perfect yet) * perf(fmtstr): be faster * style(fmtstr): more docs, some cleanup * fix(fmtstr): small fixes + more docs * style(fmtstr): cleanup small style issues * fix(fmtstr): fix handling of szmax in merge_atoms_overlapping * fix(fmtstr): fix Atom __getitem__ for out-of-bounds index * refactor(fmtstr): docs and cleaner code * fix(fmtstr): small test/doc fixes * tests(fmtstr): add example as tests for other arches * doc(fmtstr): more docstrings * fix(fmtstr): fix cyclic_find warnings * refactor(fmtstr): remove another nested function * tests(fmtstr): fix doctest output for wrong arch * style(fmtstr): remove unused imports * tests(fmtstr): add binaries for tests
30 lines
794 B
C
30 lines
794 B
C
#ifdef _FORTIFY_SOURCE
|
|
#undef _FORTIFY_SOURCE
|
|
#endif
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <sys/mman.h>
|
|
#define MEMORY_ADDRESS ((void*)0x11110000)
|
|
#define MEMORY_SIZE 1024
|
|
#define TARGET ((int *) 0x11110100)
|
|
int main(int argc, char const *argv[])
|
|
{
|
|
char buff[1024];
|
|
void *ptr = NULL;
|
|
int *my_var = TARGET;
|
|
ptr = mmap(MEMORY_ADDRESS, MEMORY_SIZE, PROT_READ|PROT_WRITE, MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE, 0, 0);
|
|
if(ptr != MEMORY_ADDRESS)
|
|
{
|
|
perror("mmap");
|
|
return EXIT_FAILURE;
|
|
}
|
|
*my_var = 0x41414141;
|
|
write(1, &my_var, sizeof(int *));
|
|
scanf("%s", buff);
|
|
dprintf(2, buff);
|
|
write(1, "DONE", 4);
|
|
write(1, my_var, sizeof(int));
|
|
return 0;
|
|
}
|