fork download
  1. // clang-7 -o example1 example1.c
  2. // To run using clang with stack protection
  3. // clang-7 -fsanitize=safe-stack -o example1 example1.c
  4. // To run using gcc
  5. // gcc example1.c -o example1
  6.  
  7. #include <stdio.h>
  8. #include <string.h>
  9.  
  10. void f(char* t){
  11. int authenticated = 0;
  12. char buf[4];
  13. strcpy(buf, t);
  14. if(authenticated){
  15. printf("Access allowed!\n");
  16. } else{
  17. printf("Access denied!\n");
  18. }
  19. }
  20.  
  21. int main(int argc, char* argv[])
  22. {
  23. f("ABCDEFGHIJKLMNO");
  24. return 0;
  25. }
Success #stdin #stdout 0s 5320KB
stdin
"ABCDEF"
stdout
Access denied!