First page Back Continue Last page Summary Graphics
String Copy and Concatenation
Traditional functions strcpy(), strcat() unsafe
- No count parameter
- Unbounded src string overflows dest
-
Usual advice: use strncpy(), strncat()
- Additional parameter is a maximum count
Inconsistent count parameter semantics
- strncpy(): size of dest buffer
- strncat(): number of chars to copy