cコードはこのようになっています、
void foo (char *x){
int buf[1];
strcpy((char *) buf, x);
}
void callfoo() {
foo("abcdefghi");
}
アセンブリコードfooの一部は
leal 0xfffffffc(%ebp), %eax
pushl %eax
call 80483c4 <strcpy>
movl %ebp, %esp
popl %ebp
ret
strcpyが%eaxをbufで埋めることを期待していたので、%ebp-4、%ebp、%ebp + 4(古い%ebp)%ebp + 8(fooの差出人アドレス)まで埋められます。 。私の攻撃文字列は「abcdefghi」です
ケースの下にバッファがいっぱいになります、
%ebp-0x4 = 64636261
%ebp = 68676665
%ebp+0x4 = 08040069
しかし、ソリューションは、%ebp〜%ebp+0x8がいっぱいになると言っています。スタック構造を誤解しましたか?
ソリューションによると、
B. Immediately before the ret instruction at address of foo, what is the value of the frame pointer register %ebp?
%ebp = 0x68676665
C. Immediately after the ret instruction of foo, what is the value of the program counter register %eip?
%eip = %ebp+8(it is changed by strcpy)