Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q . 8 . ( Marks: 1 0 ) #include #include #include int foo ( char * str ) { char buffer [ 1 0

Q.8.(Marks: 10)
#include #include #include int foo(char *str)
{ char buffer[100]; /* The following statement has a buffer overflow problem */ strcpy(buffer, str); return 1;
int main(int argc, char **argv)
char str[400];
FILE *badfile;
badfile = fopen("badfile","r");"
fread(str, sizeof(char),300, badfile);
foo(str);
printf("Returned Properly
");
return 1;
In the above given sample code expalin how you would perform a bufferoverflow attack. Draw a detailed diagram of position of variables placed on the stack. Finally also explain how canary based protection mechanism can be used as defense.

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_2

Step: 3

blur-text-image_3

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

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions