c++ - creating a txt file to call f2() without modiying the code -
creating txt file call f2() without modiying code how input file , not modify code file have adress of f2() program print "hello world"
note: f2() address 00 40 10 14 , in reverse buffer on flow read 14 10 40 00
#include <iostream> #include <cstdio> using namespace std; int i; unsigned int* p; void f1() { int a=10; char str[4]; cout << "please enter string:"; while (!cin.eof()) { cin.get(str[i]); i++; } printf("address of str is:%x\n",str); printf("address of is:%x\n",&a); cout << "the string entered is:"; cout << str << endl; } void f2() { cout << "hello world!\n"; } main() { printf("the address of function f2:%08x\n",f2); f1(); }
you may @ example buffer overrun http://blogs.msdn.com/b/roberthorvick/archive/2004/01/16/59460.aspx
Comments
Post a Comment