Question: Rewrite the program shown in Figure 10.11a so it is no longer vulnerable to a buffer overflow: /* record type to allocate on heap /

Rewrite the program shown in Figure 10.11a so it is no longer vulnerable to a buffer overflow:

Rewrite the program shown in Figure 10.11a so it is no longer

/* record type to allocate on heap / typedef struct chunk char inp [ 64]; void ( process) (char *); /* vulnerable input buffer */ /*pointer to function to process inp */ ) chunk_t; void showlen (char *buf) int len; len = strlen (buf); printf("buffer5 read %d chars ", len); int main (int argc, char *argv[]) chunk t next setbuf (stdin, NULL); next-malloc (sizeof (chunk_t)); next->processshowlen; printf ("Enter value: "); gets (next->inp); next->process (next->inp); printf ("buffer5 done ")

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!