Advertisement
Guest User

bufferoverfloweaxample

a guest
Mar 10th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<stdlib.h>
  4.  
  5. int main(void){
  6.  
  7. char log_success = 0;
  8. char user_info[14];
  9. char user = 'F', pass = 'F';
  10. char pass_info[12];
  11. printf("Enter UserID: \n");
  12. scanf("%s",user_info);
  13. printf("Enter Password: \n");
  14. scanf("%s",pass_info);
  15.  
  16. if(strcmp(user_info,"secureassign"))
  17. {
  18. printf("The UserID is incorrect. \n");
  19. }
  20. else{
  21. printf("Correct UserID \n");
  22. user = 'T';
  23. }
  24. if(strcmp(pass_info,"abcd1234"))
  25. {
  26. printf("The password you entered is incorrect. \n");
  27. }
  28. else{
  29. printf("Correct password \n");
  30. pass = 'T';
  31. }
  32. if((pass!='F' && user!='F'))
  33. {
  34. printf("You have successfully logged in. \n");
  35. printf("You are now System Admin. Root privileges given. \n");
  36. }
  37. printf(user_info);
  38. printf(pass_info);
  39. printf("\n");
  40. return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement