2 ms·
That isn't an error in strncpy — it's for manipulating fixed length fields, which is why it zeroes the entire remaining field. strncpy is commonly misused as a
by loeg 8y ago
That isn't an error in strncpy — it's for manipulating fixed length fields, which is why it zeroes the entire remaining field.
strncpy is commonly misused as a strlcpy, though, in part because glibc continues to refuse to add strlcpy. strlcpy provides the functionality most people want from strncpy but do not get.