I am doing some basic research on stack overflow and have some trouble how to overwrite/modify a local variable that is located below the buffer in the memory.
Consider the following piece of pseudo C code
char buff[20];
int pass=0;
.
.
.
gets(buff)
check if buff equals something, if true set pass == 1
if pass == 1, grant access
Now, from what I gather the variables declared are ordered inversely on the stack. That is, buff is located above pass in the stack. When gets copies something into buff, the buffer grows towards high address space - towards the return address and away from the pass variable. It doesn't matter what input I type - I simply cannot overwrite pass since it is on the 'wrong' side of the buffer?