I've been studying binary exploitation and recently I found a problem that I cannot find an answer for... I have the following code:
void vuln(char *s) {
char buf[10];
strcpy(buf, s);
}
int main (int argc, char** argv) {
vuln(argv[1]);
printf("YOU LOSE!\n");
return 0;
}
The strcpy call allows me to exploit a buffer overflow so I can override the RBP and RIP registers... the thing is send 10 'A' to fill the buffer, 8 'B' to fill the RBP and only 6 'C' to fill the RIP?! I cannot understand why only 6 bytes are needed instead of 8, which is the register size (64bit platform)