If we copy or insert data more into an array of limited size, it is referred as array overflow.
Look at the following code:
char var1[10];
char var2[7] = \"bhushan\"; /* '\0' is not added ,as size is given as 7*/
strcpy( var1, var2 ); Here, we can find that var2 (“bhushan”) is not terminated with a Null terminator (‘\0’). So when we copy var2 to var1 using strcpy( ), the strcpy( ) routine will copy all the character to var2 until it finds ‘\0’ in memory. So array overflow may result in memory overwrite!
Author : Bhushan Verma
0 nhận xét:
Post a Comment