fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <alloca.h>
  5.  
  6. int check_authentication(char *password) {
  7. char *password_buffer = alloca(16);
  8. int *auth_flag = alloca(4);
  9. *auth_flag = 0;
  10.  
  11. strcpy(password_buffer, password);
  12.  
  13. if(strcmp(password_buffer, "brillig") == 0)
  14. *auth_flag = 1;
  15. if(strcmp(password_buffer, "outgrabe") == 0)
  16. *auth_flag = 1;
  17.  
  18. return *auth_flag;
  19. }
  20.  
  21. int main(int argc, char *argv[]) {
  22. if(argc < 2) {
  23. printf("Usage: %s <password>\n", argv[0]);
  24. exit(0);
  25. }
  26. if(check_authentication(argv[1])) {
  27. printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  28. printf(" Access Granted.\n");
  29. printf("-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  30. } else {
  31. printf("\nAccess Denied.\n");
  32. }
  33. }
Success #stdin #stdout 0s 2156KB
stdin
"\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08\xb6\x85\04\x08"
stdout
Usage: ./prog <password>