我不能溢出缓冲区
I can not overflow buffer
我看到了缓冲区溢出代码,但我不能溢出它。是否有任何 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
我看到了缓冲区溢出代码,但我不能溢出它。是否有任何 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