What is Buffer overflow?
[[File:Buffer overflow basicexample.svg|thumb|Basic example: Two variables, one a character array (string), the other a number. Writing more characters than the array's length changes the value of the other variable. ]] A '''buffer overflow''' is a kind of vulnerability of [[software]]. It occurs when a program writes data into a buffer that is longer than the buffer's allocated size. Part of the data will then be written into an area which is not part of the buffer. Because the buffer overflow changes other data as well, this can cause a program to malfunction. Buffer overflows are commonly used as a [[security exploit]]. When planned properly, it is possible to write data into memory, which will then be executed as a program, possibly with a different privilege level. This is known as [[privilege escalation]]. Buffers are widespread in [[operating system]] (OS) code, so it is possible to make attacks that perform privilege escalation and gain unlimited access to the computer's resources. The [[Morris worm]] of 1988 used this. There are certain [[Programming language|programming languages]], such as C or C++ that do not protect well against accessing or overwriting data in any part of memory. They also do not check the that the data written into an array is not larger than the array. Bounds checking can prevent buffer overflows, but it needs more code, and processing time. Modern operating systems protect themselves against buffer overflows. One technique is to use a random location in memory, by leaving some spacce between buffers, and by looking ofr actions that write to those areas. The so-called [[off-by-one error]] can also cause a buffer overflow. Suppose an array has a size of 50 elements. The first element is at position 0, the second at position one, etc. The last one is at position 49. Using position 50 will cause a buffer overflow. Buffer overflows cause the following problems: * Data corruption.Overflowing data can overwrite and corrupt important program data, causing errors, crashes,