小编JDo*_*oby的帖子

黑客挑战 - 定位代码中的漏洞

我的朋友最近完成了一项黑客挑战并将其发送给我(二进制文件和源代码)。在向他寻求建议之前我想先在这里问一下,因为我想自己做:)

我一直在经历它,但我正在努力寻找漏洞。

#include <alloca.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

static void usage(const char *argv0) {
    printf("Build your own string!\n");
    printf("\n");
    printf("Usage:\n");
    printf("  %s length command...\n", argv0);
    printf("\n");
    printf("Each command consist of a single character followed by it's index.\n");
    printf("\n");
    printf("Example:\n");
    printf("  %s 11 h0 e1 l2 l3 o4 w6 o7 r8 l9 d10\n", argv0);
    exit(1);
}

int main(int argc, char **argv) {
    char *buffer;
    unsigned short buffersize, i, index, length;

    if (argc < 2) usage(argv[0]);

    length = atoi(argv[1]);
    if …
Run Code Online (Sandbox Code Playgroud)

c stack buffer overflow

3
推荐指数
1
解决办法
1715
查看次数

标签 统计

buffer ×1

c ×1

overflow ×1

stack ×1