Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do not answer this question if you do not know how to do buffer over flow. Please do not copy and paste previous answers

Please do not answer this question if you do not know how to do buffer over flow. Please do not copy and paste previous answers by other people who did not read instructions and provided the wrong answer. I saw those incorrect codes so please stop wasting my questions by copying and pasting incorrect things. The source code is not to be changed at all. Meaning do not add any lines of code or take anything out PERIOD. This is a buffer over flow assignment I need help with this if you can not assist me then move along.

Please see the source code below written in C++. Can you make the code print Hello World! by providing it with an input string? You are NOT allowed to modify the source code. Compile the code with g++. Submit your input string and the screenshot proving that the code prints Hello World!.

Update: Mac OS loads the executable to a random memory location for security reasons like this. The technology is called Address Space Layout Randomization (ASLR, http://en.wikipedia.org/wiki/Address_space_layout_randomization). The implication to the homework is that the address of function f2 will be different every time it is executed. This makes accomplishing the homework very difficult if not impossible. There is a g++ linker option that prevents linker from generating position independent executable (pie). Mac OS loader will then load the executable generated in this way to a fixed position. You can use following command to generate the executable: g++ -Wl,-no_pie -o bof.out bof.cpp

Update: Starting from Microsoft Vista, Windows OS also uses ASLR. There are many resources online. I havent tested them. But you can try some of the methods online to finish the homework.

Source Code that can not be modified.

#include #include

using namespace std; char *p;

void f1() { char str[8]; p = str;

cout << "Please enter a string:";

while (!cin.eof()) { cin.get(*p); p++; } cout << "The string you entered is:" << str << endl; }

void f2() { cout << "Hello World! "; }

int main() { cout << sizeof(char*) << endl; cout << (void*) f2 << endl; f1(); 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

More Books

Students also viewed these Databases questions

Question

=+j Improve the effectiveness of global and virtual teams.

Answered: 1 week ago