3 ms·
For the first two points, you end up overwriting the stack and most likely crash. This is how security holes were/are made. For the third point, you have two m
by daemin 8y ago
For the first two points, you end up overwriting the stack and most likely crash. This is how security holes were/are made.
For the third point, you have two main ways of storing strings in general. The first was called pascal style, where the length is stored first in either a byte or two and then the string data with no (or an optional) terminating null character (the '\0'). The second is referred to as c style, and is done by storing the string in a memory and denoting the end of the buffer by a null character.
The c-style enables certain nicer looking c code with loops and such, but it is more dangerous and potentially expensive if you recompute the length all the time.
You can always mix and match the way you store the string, such as in C++ where the string class stores a length as well as a null terminated string in a buffer.
For your forth point, yes, you end up corrupting the string leading to more crashes and/or it can be used as an entry point to screw around with your program's stack.