int a(char *string){
---define some string here
val= strcmp (validString, string) == 0;
return val? 1 : 0;
}
int b(int a) {
do some stuff here
}
void main(int argc, char **argv){
int c = 3434;
char in[9];
scanf("%s", n);
if (a(in)){
b(c);
}
}
I was wondering if it was possible to overflow the variable "in" and jump to b with the arguments intact?
I know how to overflow and jump to an address in the program. But i don't know how I could call b with the argument(c).
If i try jumping to b(c); GDB tells me "Cannot access memory at address 0x3638785c"
Any hints or ideas I could use?
*Also note ASLR is disabled and so is stack protection
a
and executeb
every time, regardless of the string comparison result? – yano Dec 7 at 0:31in
with the value ofc
in the appropriate place? Or is the hard part here assuming you don't know the value ofc
? I'm not quite sure how all this would line up in memory without looking, this may be a dumb comment – yano Dec 7 at 0:52