Heap-OverFlow-Example
#HeapOverFlowExample
#Allocating Memory on w
#include <stdio.h>
void main(int argc, char** argv)
{
char* buff=malloc(10);//To create memory of 20 byte for buff variable
strcpy(buff, argv[1]);//If user input more than 19 charcter and strcpy try to copy in buff variable will cause heap overflow
free(buff);
}
//Try
root@bt:~/Desktop/c# ./heapoverflow 01234567890123456789012
#Allocating Memory on w
#include <stdio.h>
void main(int argc, char** argv)
{
char* buff=malloc(10);//To create memory of 20 byte for buff variable
strcpy(buff, argv[1]);//If user input more than 19 charcter and strcpy try to copy in buff variable will cause heap overflow
free(buff);
}
//Try
root@bt:~/Desktop/c# ./heapoverflow 01234567890123456789012
0 comments:
Post a Comment