please, need assistance on my assignment which is due soon.
1a: Examine the code below and draw stack frames when function1, function2 and function3 are called by the main program for a 32-bit system. Use objdumb and GDB debugger to analysis the assembly code of the functions. Draw the stack frame after analysing the assembly code. Figure 2 shows a sample stack frame of a function. The requirement of this part is to produce three stack frames corresponding to the three functions of the code. The addresses and the corresponding content of the stack (as per the assembly code of the functions) should be included according to the format shown in Figure 2. The screenshot of the assembly code of the functions should also be included.
1b: Identify a software vulnerability in the code. Exploit the vulnerability and execute function4 instead of function3. It is important to note that function4 never gets called by the main function. Your task is to inject a command line argument such that function4 gets called, instead of function3. Include screenshots of the entire process and explain the stack exploitation procedure.
int function1(int x, int y, int z)
{
int result_func1;
result_func1 = x + y + z;
return result_func1
}
int function2(int x, int y, char* input_string)
{
int result_func2;
char buffer[20];
strcpy(buffer, input_string);
printf("your input string %s is copied in the buffer \n", input_string);
result_func2= x - y;
return result_func2
}
void function3(int result1, int result2)
{
printf("The result of function 1 is %d\n", result1);
printf("The result of function 1 is %d\n", result1);
}
void function4(void)
{
printf("The function never gets called is \n");
exit(-1);
}
int main(int argc, char* argv[])
{
int result1;
int result2;
result1 = function1(5, 10, 15);
result2 = function2(20, 8, argv[1]);
function3(result1, result_func1);
}
i'll really appreciate if someone can put me through