Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the next program, there is buffer overflow present. Your task is to fix the

ID: 3720595 • Letter: F

Question

For the next program, there is buffer overflow present. Your task is to fix the code so that buffer overflow can be avoided Here is the link for the mentioned article: H. Shahriar et al., "Buffer Overflow Patching for Cand C++ Programs Rule-Based Approach," ACM SIGAPP Applied Computing Review, Vol. 13, Issue 2, June 2013, pp. 8-19 Kennesaw Digital Library void main ) char src[10]: printf ("enter name) gets (src); void main O char *src-"hello world"; 1) char dest[5]; memcpy (dest, src, 10); void main (f char src[10]; printf (enter name"); fgets (src, sizeof(src), stdin); void main O char *src-"hello world" char dest[5]; int n = sizeof (src); if (sizeof (dest)

Explanation / Answer

The answer would be

2) void main(){

char src[10];

printf("enter name");

fgets(src,sizeof(src),stdin);

printf("%s",src);

}