Question: 1&2 1/ Rewrite the program for Q1 above to create a fic for this problem by limiting the size of user input and possibly using

 1&2 1/ Rewrite the program for Q1 above to create a

1&2

fic for this problem by limiting the size of user input and

possibly using a different c function to compare the strings. Use this

1/ Rewrite the program for Q1 above to create a fic for this problem by limiting the size of user input and possibly using a different c function to compare the strings. Use this example: bytebyte 2/ Demonstrate buffer overflow problem with a screenshot about "Wrong Password" as given in Qlin the problem set. The user should not be getting root privileges. But the user does so because the "localinfo.pass"flag gets corrupted. #include #include #include int main(void) {//Use struct to force local variable memory ordering struct {char BUFF [5]; char pass;} LOCALINFO; LOCALINFO.PASS =0; PRINTF (" Enter thepassword: "); GETS (localinfo. buff); I/Get thepassword from the user { // Check the passwordprintf (" Wrong Password "); } else { printf (" Correct Password "); LOCALINFO.PASS =1;//Setaflagdenoting correct PASS} IF (LOCALINFO.PASS) {/*NowGiveroot oradmin rightstouser*/ PRINTF (" Congratulations! Root privileges given TOTHEUSER! ");} RETURNO;} Problem Set 1. Edit the program to demonstrate buffer overflow problem with a password of size twice the given length (e.g. "bytebyte"). A reference code is attached in the assignment. 2 Rewrite the program for Q1 above to create a fix for this problem by limiting the size of user input and possibly using a different C function to compare the strings. Your improved program should display an output wrong password" for the following cases a) attempt password = "by". User input is half that of given password text. Problem Set 1. Edit the program to demonstrate buffer overflow problem with a password of size twice the given length (eg. "bytebyte"). A reference code is attached in the assignment. 2. Rewrite the program for Q1 above to create a fix for this problem by limiting the size of user input and possibly using a different C function to compare the strings. Your improved program should display an output "wrong password" for the following cases a) attempt password = "by". User input is half that of given password text

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!