Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Look very carefully at the code below. Can you identify what kind of problem this program will cause (be specific). Feel free to put the

Look very carefully at the code below. Can you identify what kind of problem this program will cause (be specific). Feel free to put the code in your IDE and see if you can

run it. (It may or may not run). What mediation mechanism(s) could you use to stop this problem from happening? Think of terms in computer security, example: does something cause a buffer overflow?

#include #include

void foo(const char* input)

{

char buf[10]; printf("My stuff looks like: %p %p %p %p %p % p ");

strcpy(buf, input); printf("$s ", buf);

printf("My stuff now looks like: %p %p %p %p %p % p "); }

void bar(void)

{ printf("I have been hacked!!");

}

int main(int argc, char* argv[])

{ printf("Address of foo = %p ", foo); printf("Address of bar = %p ", bar); if (argc != 2)

{ printf("Please supply a string as an argument! ");

return -1; }

foo(argv[1]);

return 0;

}

image text in transcribed

#include #include void foo(const char* input) char buf[10]; printf("My stuff looks like: %p %p %pin%p %p % p "); strcpy(buf, input); printf("$sIn", buf); printf("My stuff now looks like: %p %p %p %p %p % p "); void bar(void) printf("I have been hacked!!"); int main (int argc, char* argv[I) printf( "Address of foo = %p ", foo); printf( "Address of bars %p ", bar); if (argc != 2) printf("Please supply a string as an argument! "); return -1; foo(argv[1) return 0

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

Identify and describe basic workplace competencies

Answered: 1 week ago

Question

Describe the steps involved in coaching to improve poor performance

Answered: 1 week ago