]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Use strlcpy() instead of strncpy() to copy the string returned by
authortruckman <truckman@FreeBSD.org>
Thu, 12 May 2016 06:39:13 +0000 (06:39 +0000)
committertruckman <truckman@FreeBSD.org>
Thu, 12 May 2016 06:39:13 +0000 (06:39 +0000)
commit78a1b1f17d2d6566f52664f13a63608d41e58728
treebaa89926a104467604c5aee607c213a43a13bfc9
parentde0ce9dbae0c46d012828b229ec26104d8e6cd08
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
lib/libfetch/http.c