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
This commit is contained in:
parent
3736b2dd32
commit
611cf39267
@ -456,7 +456,7 @@ fetch_socks5_init(conn_t *conn, const char *host, int port, int verbose)
|
||||
goto fail;
|
||||
}
|
||||
*ptr++ = strlen(host);
|
||||
strncpy(ptr, host, strlen(host));
|
||||
memcpy(ptr, host, strlen(host));
|
||||
ptr = ptr + strlen(host);
|
||||
|
||||
port = htons(port);
|
||||
|
Loading…
Reference in New Issue
Block a user