Answer the question
In order to leave comments, you need to log in
How to delete the return link?
Hello! I was given a task at school so that I would call another from one function, but I did it in a non-obvious way. They gave a hint: to overwrite the return link, but it's not entirely clear how this can be implemented?
Here is an erroneous example:
#include <iostream>
using namespace std;
void bar(){
cout << "bar" << endl;
}
void foo(){
bar(); // это не правильно, так как явно вызвали сами, а нужно как-то вклинить в эту функцию
cout << "foo" << endl;
}
int main(){
foo(); // сделать должна быть вызвана bar(), хотя вызывали foo
return 0;
}
#include <iostream>
using namespace std;
void bar(){
cout << "bar" << endl;
}
void foo(){
cout << "foo" << endl;
}
int main(){
foo(); // тут должен быть вызван bar(), хотя вызывали foo
// что для этого можно сделать?
return 0;
}
Answer the question
In order to leave comments, you need to log in
What is it for? And so that you know how hackers break you. The easiest way to do this is to arrange a buffer overflow.
void foo()
{
void* a[1];
a[1] = (void*)&bar;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question