Question: 1/ Edit the program below to demonstrate buffer overflow problem with a password of size twice the given length (e.g: peacepeace) 1/ Edit the program

1/ Edit the program below to demonstrate buffer overflow problem with a password of size twice the given length (e.g: "peacepeace")

1/ Edit the program below to demonstrate buffer overflow problem with a

1/ Edit the program below to demonstrate buffer overflow problem with a password of size twice the given length (e.g., "peacepeace"). 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. #include #include #include int main(void) {//Use struct to force local variable memory ordering struct {char BUFF (51; char pass;} LOCALINFO; LOCALINFO.PASS=0; PRINTF (" Enter thepassword: "); GETS (localinfo. buff); 1/Get thepassword from the user 1/FGETS (localinfo.buff, byte_size, stdin); IF (STRCMP (localinfo.buff,"byte")) { // 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;}

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!