On 7/24/2018 7:04 PM, Brian C. Lane wrote: >> strncpy doesn't fill the remainder with zeros, and if it runs out of >> space, leaves the string unterminated, so you have to manually set the >> last byte of the buffer to zero. > > Not according to the manpage for strncpy on Fedora 28: > > "If the length of src is less than n, strncpy() writes additional null > bytes to dest to ensure that a total of n bytes are written."
Ahh, missed that part. But the important part is this: Warning: If there is no null byte among the first n bytes of src, the string placed in dest will not be null-terminated.
signature.asc
Description: OpenPGP digital signature
