From nobody Fri Nov 11 18:36:54 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N86qp5Qwpz4dbRM; Fri, 11 Nov 2022 18:36:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N86qp4Rxwz3w9d; Fri, 11 Nov 2022 18:36:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668191814; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kXdbAW3O3ncAlotsjCZd4Nqvnak6qlnpxkN+0dZzPS4=; b=v24esv6D+TJ3EGvB7hX/tphXMaBf6R/UmJ0gbcN5RJky3UXG5VrR8Ivh3eKNYwgWKL9wkP YT7FKflILuTxy7gxbaxDCN6UOPDGs7dyV1VMXggCy8hezABfjaLQIZrL356Fmeof1NBbBz mkMlxntKMB0bTDfYI5vIz9YYqHbG2GPVaCg4aZnU5h+DJSV97spMGudvx8Y2uVwTkew+8H FAb/yVWPaK4832fLlg0QBU1YjXC7cmmbNCMCHappwt1PmLjGKHXXEq2yI3sc/YoOoAXdOZ jS6bOeK4qSwGSgeWORp3oqb+iZxTxnyidd8ffCTGOlNQQX+QQMmhKAEF2XEgJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668191814; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kXdbAW3O3ncAlotsjCZd4Nqvnak6qlnpxkN+0dZzPS4=; b=jdvZrVk1t9eUInx9T+S8oRX6UMsOpwUesmH3Sip4O8aQOOAOOYqCAJTkr6ufbu3vVH9Xty 0un8wjMOV5dEAjHPPk17xU1mHAdBfnx4QPFkdMRmfqpCl0HbwEuCso6XgM0bAKNIDHie5l Kovh+6xuRPY3QEhQo/UPfTF/KgIv+2gwzbW22J5FiLE6Ef2N7dzp18p8lVYVibACl1IPka BpKPrLCak0UyJ5Z4R4CobhoriIT1FrjRQtDSPQxbTi4HNyp30Am5WMfaYIt5Ny8bTJVWa6 82k5IiPuyhgF1pZNt6EOy0CrgWiXyh87z1GchEXIj6lgF8/kSHn7+cj0V5gtJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668191814; a=rsa-sha256; cv=none; b=laYyPJXW8Jec4mJHuJNL0a7MzWrVVjBiH1wlemOqaKtyA9syV/u2X4IiFzvVqUd9iF/42C qjTWvqsYc+hmqOe8F1YtFiRxuSDRFkZAjGeo7o/dDgVKIE/IKJ6eLRoGG0jk1k10tS2gtv olJM9eiSvaHHY2P4ZbBCP+Ojql5+Q+9xvlsT/6AnWgYuNmemZ/MSGm9gzoMBTnaDNl/XXm oU6lea6Xu07CbL3TF3uFX/JUVf42OOqNJdoYATZ1ExX5dso83OCKFvAdipIof2ZOQR3Iyh CgNpOt9s1wWc25eJlK4i8Ztvgh0AQ7DtsBP3qk5Lf0ULPjkiB1S0P7JAN/h+8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N86qp3Y6gzsqm; Fri, 11 Nov 2022 18:36:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2ABIasrX004208; Fri, 11 Nov 2022 18:36:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ABIasWe004207; Fri, 11 Nov 2022 18:36:54 GMT (envelope-from git) Date: Fri, 11 Nov 2022 18:36:54 GMT Message-Id: <202211111836.2ABIasWe004207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 7cefb4bc4b1c - stable/13 - libfetch: Use memcpy in place of an odd strncpy. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7cefb4bc4b1cf8c5e61a2dde8c84249712290319 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7cefb4bc4b1cf8c5e61a2dde8c84249712290319 commit 7cefb4bc4b1cf8c5e61a2dde8c84249712290319 Author: John Baldwin AuthorDate: 2022-10-03 23:10:43 +0000 Commit: John Baldwin CommitDate: 2022-11-11 18:18:54 +0000 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index 628ab69612f7..47545e5178c3 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -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);