Question: The following is a flawed login program in C. Identify the flaw and explain how to fix it. I need this for one of my
"The following is a flawed login program in C. Identify the flaw and explain how to fix it."
I need this 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 true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
