Question: (b) Analyze the following code in Figure Q2(b). #include void main() char place; char *systemcommand; place (char *)malloc (10), systemcommand= (char *)malloc (32); printf(Memory

(b) Analyze the following code in Figure Q2(b). #include void main() char

(b) Analyze the following code in Figure Q2(b). #include void main() char "place; char *systemcommand; place (char *)malloc (10), systemcommand= (char *)malloc (32); printf("Memory address of place is: %d ", place); printf("Memory address of systemcommand is %d ", systemcommand); printf("The space im memory between place and systemcommand is %d ", systemcommand place); printf("Where is the best place on the web to learn network security? "); gets (place); printf("The best place to learn network security is %s ", place); system (systemcommand); } Figure Q2(b): Program code (i) State the attack of the above program code. [1 mark] (ii) Explain how the system can be exploited by this code with an aid of a diagram. [6 marks] (iii) Show the solution how to avoid the attack. [6 marks] (iv) Modify the above code based the answer given in Q2(b)(iii). [9 marks]

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 Programming Questions!