What is a buffer overflow and how do I cause one?

前端 未结 12 1934
盖世英雄少女心
盖世英雄少女心 2020-11-30 00:43

I have heard about a buffer overflow and I would like to know how to cause one.

Can someone show me a small buffer overflow example? New(And what they are used for?)

12条回答
  •  星月不相逢
    2020-11-30 01:21

    A buffer overflow is just writing past the end of a buffer:

    int main(int argc, const char* argv[])
    {
        char buf[10];
        memset(buf, 0, 11);
        return 0;
    }
    

提交回复
热议问题