HomeFreeBSD

libfetch: Use memcpy in place of an odd strncpy.

Description

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)

Details

Provenance
jhbAuthored on Oct 3 2022, 11:10 PM
Reviewer
imp
Differential Revision
D36824: libfetch: Use memcpy in place of an odd strncpy.
Parents
rG1f9f319919d7: diff: Fix a use after free as well as a memory leak in change().
Branches
Unknown
Tags
Unknown