1
我已經看到了緩衝區溢出代碼,但我不能超過它。有沒有gcc選項來編譯它?或者該代碼有任何問題。我不能溢出緩衝區
的代碼是:
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
volatile int modified;
char buffer[64];
if(argc == 1) {
errx(1, "please specify an argument\n");
}
modified = 0;
strcpy(buffer, argv[1]);
if(modified == 0x61626364) {
printf("you have correctly got the variable to the right value\n");
} else {
printf("Try again, you got 0x%08x\n", modified);
}
}
,我試圖運行這樣說:
perl -e 'print "A"x64 . "dcba"' | xargs ./main
這看起來非常棘手,無需查看生成的代碼即可正確使用。你有什麼?這個過程是否會崩潰? – cnicutar
溢出緩衝區將寫入其後的內存,但「修改」可能位於其之前的內存中(取決於編譯器)。 – interjay
這是一個ctf挑戰[here](http://exploit-exercises.com/protostar/stack1)是 –