]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libfetch: Use memcpy in place of an odd strncpy.
authorJohn Baldwin <jhb@FreeBSD.org>
Mon, 3 Oct 2022 23:10:43 +0000 (16:10 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 11 Nov 2022 18:18:54 +0000 (10:18 -0800)
commit7cefb4bc4b1cf8c5e61a2dde8c84249712290319
tree3fbddcc806ea0fa3db67b96bcc8df3588cb6aee2
parent1f9f319919d7f8b76c8d8a7edb71ca2f39fb40e1
libfetch: Use memcpy in place of an odd strncpy.

The length passed to strncpy is the length of the source string, not
the destination buffer.  This triggers a non-fatal warning in GCC 12.
Hoewver, the code is also odd.  It is really just a memcpy of the
string without its nul terminator.  For that use case, memcpy is
clearer.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D36824

(cherry picked from commit 611cf392672cf7aa52a593412fb2537546a7d6a4)
lib/libfetch/common.c