Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In addition to stack-based buffer overflow attacks (i.e., smashing the stack), heap overflows can. Consider the following C code, which illustrates a heap overflow. int

image text in transcribed

In addition to stack-based buffer overflow attacks (i.e., smashing the stack), heap overflows can. Consider the following C code, which illustrates a heap overflow. int mainO {int diff, size = 8; char *bufl, *buf2; bufi = (char*)malloc(size); buf2 = (char*)malloc(size); diff = buf2 - bufi; memset(buf2, '2', size); printfCBEFORE: buf2 = %s", buf 2); memset(bufl, ', diff + 3); print("AFTER: buf 2 = */.s", buf 2); return 0;} a. Compile and execute this program. What is printed? b. Explain the results you obtained in part a. c. Explain how a heap overflow might be exploited by Trudy

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions