Advertisement
Mito125

Stack02 code

Dec 7th, 2011
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <unistd.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. int main(int argc, char **argv)
  7. {
  8. volatile int modified;
  9. char buffer[64];
  10. char *variable;
  11.  
  12. variable = getenv("GREENIE");
  13.  
  14. if(variable == NULL) {
  15. errx(1, "please set the GREENIE environment variable\n");
  16. }
  17.  
  18. modified = 0;
  19.  
  20. strcpy(buffer, variable);
  21.  
  22. if(modified == 0x0d0a0d0a) {
  23. printf("you have correctly modified the variable\n");
  24. } else {
  25. printf("Try again, you got 0x%08x\n", modified);
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement