Advertisement
Guest User

Edited double free

a guest
Aug 27th, 2022
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | Cybersecurity | 0 0
  1. #include <stdio.h>
  2. #include <malloc.h>
  3. int main(){
  4.  
  5. char *a = (char*) malloc(10);
  6. char *b = (char*) malloc(10);
  7. char *c = (char*) malloc(10);
  8.  
  9. printf("a is at memory %p \n",a);
  10. printf("b is at memory %p \n",b);
  11. printf("c is at memory %p \n",c);
  12.  
  13. free(a);
  14. printf("Freeing a \n");
  15.  
  16. free(c);
  17. printf("Freeing c \n");
  18. free(b);
  19. printf("Freeing b : To bypass fastbin top check \n");
  20. free(c);
  21. printf("Freeing c again \n");
  22.  
  23.  
  24. return 0;
  25.  
  26. }
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement