Advertisement
Guest User

Untitled

a guest
Dec 13th, 2011
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <sys/mman.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. #include <fcntl.h>
  6. #include <stdio.h>
  7. #include <string.h>
  8.  
  9. char *name = "libstlport.so";
  10.  
  11. int main( void )
  12. {
  13. int fildes = open( name, O_RDWR );
  14. int size = 223260;
  15. void *map_address = mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fildes, 0);
  16. char ehdr[52] = { 0 };
  17.  
  18. printf("map_addr %08X\n", map_address );
  19.  
  20. memcpy (map_address + 0, ehdr, sizeof (ehdr));
  21.  
  22. return 0;
  23. }
  24.  
  25. /*
  26.  
  27. > gcc test.c
  28. > ./a.out
  29. map_addr B7E68000
  30. Bus error
  31. >
  32.  
  33. */
  34.  
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement