CompTIA CySA+CS0-002 – Question018

An internally developed file-monitoring system identified the following excerpt as causing a program to crash often:
char filedata[100];
fp = fopen("access.log", "r");
srtcopy (filedata, fp);
printf ("%sn", filedata);
Which of the following should a security analyst recommend to fix the issue?

A.
Open the access.log file in read/write mode.
B. Replace the strcpy function.
C. Perform input sanitization.
D. Increase the size of the file data butter.

Correct Answer: B