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

前端 未结 12 1927
盖世英雄少女心
盖世英雄少女心 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

    The "classic" buffer overflow example is:

    int main(int argc, char *argv[])
    {
        char buffer[10];
        strcpy(buffer, argv[1]);
    }
    

    That lets you play with the buffer overflow parameters and tweak them to your hearts content. The book "Hacking - The Art of Exploitation" (Link goes to Amazon) goes into great detail about how to play around with buffer overflows (purely as an intellectual exercise obviously).

提交回复
热议问题