HomeFreeBSD

Use strlcpy() instead of strncpy() to copy the string returned by

Description

Use strlcpy() instead of strncpy() to copy the string returned by
setlocale() so that static analyzers know that the string is NUL
terminated. This was causing a false positive in Coverity even
though the longest string returned by setlocale() is ENCODING_LEN
(31) and we are copying into a 64 byte buffer. This change is also
a bit of an optimization since we don't need the strncpy() feature
of padding the rest of the destination buffer with NUL characters.

Reported by: Coverity
CID: 974654

Details

Provenance
truckmanAuthored on
Parents
rS299519: Typo in comment.
Branches
Unknown
Tags
Unknown