Secure Coding and Vulnerabilities Quiz
Casual Mode - Take your time!
1 / 20
Correct
0
Incorrect
0
Score
0%
Multiple Choice
int main(int argc,char* argv[]) {
int *ptr1=new int;
if(ptr1==NULL) exit(1);
int *ptr2=new int;
if(ptr2==NULL) exit(1);
char* j;
j=argv[1];
int k=atoi(j);
if (j==0){
Ptr1=&k;
delete ptr2; /*1*/
}
else {
Ptr2=&k;
}
delete ptr1; /*2*/
delete ptr2; /*3*/
return 0;
}
which line of the code should be deleted to remove vulnerability
- line 1 and line 3
- line 2 and line 3
- line 1
- line 3