Tag: security
Questions Related to security
-
1
-
2
-
1 & 2
-
No vulnerability
-
Strncpy(dst,src,len(dst))
-
Strncpy(dst,src,len(src)+1)
-
Strncpy(dst,src,len(dst)+1)
-
Strncpy(dst,src,len(dst)-1)
-
scanf("%.8s", name);
-
scanf("%8s", name);
-
scanf("%8c", name);
-
scanf("%s", name);
-
Replace cin call in line 3 with gets() function.
-
The length of input from cin cannot be limited. Use a larger array for fname.
-
Use cin.width[20] before line 3.
-
Use cin.size[19] before line 3.
-
1 and 2
-
2 and 3
-
3 and 4
-
only 2
-
line 1 and line 3
-
line 2 and line 3
-
line 1
-
line 3
-
4 - it is the size of the pointer
-
5 - it is the number of characters in the string that the pointer points to
-
4 - it is the size when 32000 is stored as integer
-
1 - it is the size of a character variable
-
program works when there is only 1 argument with program.
-
program works when there are 3 arguments with program.
-
program works when there are 4 arguments with program.
-
program never executes successfully.
-
A run-time error is encountered and the program aborts.
-
unsigned int variables cannot store the sign (+ or -) of the number. The sign is discarded and only the number is stored in i.
-
A large positive number will be stored in i.
-
Unsigned int variables cannot store signed numbers. Hence in this program i will contain garbage values.
-
1289945278
-
garbage. Integer j cannot hold such large values
-
9879879870
-
Program is aborted.