-->

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 amongst AAAAA's
    }
overflow_function(big_string);

getchar();

exit(0);

}
Blogger
Disqus
Pilih Sistem Komentar

No comments

Advertiser