Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following is a flawed login program in C. Identify the error and how to fix it. I need this problem done for one of
"The following is a flawed login program in C. Identify the error and how to fix it."
I need this problem done for one of my classes please! Anything will help.
7- (12 points) The following is a flawed login program in C. void login0f char password[ 100]; read(0, password, 100); /read password from keyboard if (verify(password) == false) exit(1); // error, and exit login // password is valid and continue bool verify(char* p) ( char pwd[8] = "secret!". // unknown to attacker char buf[8]; strcpy(buf, p) for (int 1-0; pwd[i] != '\0'; i++) if (buf[i] != pwd i]) return false; // verify the password return trueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started