Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
/* 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started