Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(int argc, char *argv[]) {
  5.  
  6. int value = 5;
  7. char buffer_one[8], buffer_two[8];
  8.  
  9. strcpy(buffer_one, "one");
  10. strcpy(buffer_two, "two");
  11.  
  12. printf("[BEFORE] buffer_two is at %p and contains \'%s\'\n", buffer_two, buffer_two);
  13. printf("[BEFORE] buffer_one is at %p and contains \'%s\'\n", buffer_one, buffer_one);
  14. printf("[BEFORE] value is at %p and is %d (0x%08x)\n\n", &value, value, value);
  15.  
  16. printf("[STRCPY] copying %d bytes into buffer_two\n\n", strlen(argv[1]));
  17. strcpy(buffer_two, argv[1]);
  18.  
  19. printf("[AFTER] buffer_two is at %p and contains \'%s\'\n", buffer_two, buffer_two);
  20. printf("[AFTER] buffer_one is at %p and contains \'%s\'\n", buffer_one, buffer_one);
  21. printf("[AFTER] value is at %p and is %d (0x%08x)\n", &value, value, value);
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement