Question: victim.c below is vulnerable. Denote the exectuable generated from victim.c as victim. If victim is a system program, a user may invoke victim and feed

victim.c below is vulnerable. Denote the exectuable generated from victim.c as victim. If victim is a system program, a user may invoke victim and feed it with a malcious string containing malicious code as the command line argument. The malcious code may eventually run within the context of victim.
/* victim.c */
#include
void f(char *str){
char foo[16];
strcpy(foo, str);
}
void main(int argc, char **argv){
f(argv[1]);
return;
}
Which line of code causes the buffer overflow directly?
line 8
line 9
line 4
line 5

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!