Take an example:
int foo(){
if(<THIS IS THE SECOND TIME YOU CALL FOO>) // I need some indicator like this
return 1;
else
return foo();
}
Essentially, I'm looking for an indicator that tells me "hey this is the second time that you have called foo". (I'm trying to avoid using static variables or changing foo function itself, just for sake of this exercise.)
I'm guessing if there's any variable related to the function's current stack frame (or maybe the caller stack frame) which I can exploit and use?