Monday, May 28, 2018

Buffer overflow example

Buffer overflow example
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

void overflow_function( char *str)
{
    char buffer[20];
    strcpy(buffer,str);
}

int main()
{
    char big_string[128];
    int i;
    for ( i=0 ; i<128 ; i++ ) {
             printf("%d\n",i);
             big_string[i] = 'A';  //fill the big_string with AAAAA's
    }
overflow_function(big_string);

getchar();

exit(0);

}

from BITCOIN NEWS https://ift.tt/2LvTqhP
via Bitcoin News Update