3 ms·
If you never write a string past the end of a buffer, you will never read past the end. If your program starts in a correct state, write operations are where it
by tedunangst 13y ago
If you never write a string past the end of a buffer, you will never read past the end. If your program starts in a correct state, write operations are where it can possibly transition to an incorrect state. The strlcpy function helps maintain the invariant that all strings in your program are actually strings, not unbounded nonsense, and so the source will be safe to use.