I'm reading Jon Erickson's art of exploitation and have a general idea about memory allocation on the stack. But the book is for 32 bit systems and I own a 64 bit system. I know that stack grows along lower memory addresses so if you initialize a certain variable var_one before var_two in a function, var_one in theory, should have a larger value of memory address than var_two. However, when I'm trying some of the exploitation techniques on my 64 bit system, its not quite making sense to me. In one of the programs I initialized an int type variable after I initialized a char buffer but still the int variable was at a higher memory address than the buffer. I tried 3 things:
int pass_check(char *password) {
char pass_buffer[10];
int auth = 0;
strcpy(pass_buffer, password);
Once like the one shown above, once with auth variable initialized before pass_buffer (initialized first) and one auth variable initialized after the strcpy() line. When examining with gdb, I'm getting the same memory address of auth variable every time for each variation of the code. I'm sure I did not make any silly error, made 3 different binaries for the 3 variants, disabled ASLR and even disabled gcc code optimizer. So why am I getting a result like this?