From nobody Mon Oct 03 23:11:31 2022 X-Original-To: dev-commits-src-main@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 4MhGmh1stGz4V1f4; Mon, 3 Oct 2022 23:11:32 +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 4MhGmg5mmQz3Qt3; Mon, 3 Oct 2022 23:11:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664838691; 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=vJGJyktgh7ndE0fd4LBZ9JWcjNzq0m3mX7tKi9kz2jw=; b=rCFSIiGwMDv9XwdGFCwXaBvcV5vUxqjVCMgzHGNgbeoAcmosPXzpM23blD4dRp1F7c6Ute f9vpFxwJADpq4wY27TDgHaOD2yzTJZwXOd1hKQ2v7s9cmRGD01dpun7+IWaiUwXk2WMHHh W5bYqvsN3xzVHbDDE7ZhkVvmjnFF56mDM1vNn3iqbOkGoGVjcKvfZjTalT5VoO6Pgpk0q4 DIUuVkbbTr+mzaNw5QnV7jW0JsdmFe6G/C/tAXINsAXgHw0I0coMALsVOw0HJFVcUH+L46 ir9oVOjtZS1PaGILPumqIkWEqvcBXC3WM8EVzBq8SpVtIs52gC2UD5Tl4Q81Qg== 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 4MhGmg4rKzzMVm; Mon, 3 Oct 2022 23:11:31 +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 293NBV6c065829; Mon, 3 Oct 2022 23:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 293NBVTe065828; Mon, 3 Oct 2022 23:11:31 GMT (envelope-from git) Date: Mon, 3 Oct 2022 23:11:31 GMT Message-Id: <202210032311.293NBVTe065828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 611cf392672c - main - libfetch: Use memcpy in place of an odd strncpy. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 611cf392672cf7aa52a593412fb2537546a7d6a4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664838691; 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=vJGJyktgh7ndE0fd4LBZ9JWcjNzq0m3mX7tKi9kz2jw=; b=skixIBwl5JHSqscNZHbe7XUQyv1Fs70AS12PSaNAWHvGMFPxJpAvsXfs3AhkAKvfO6D4GS 58oKZ9GZyZjYeBStCETAWvzd02HcHYdxetYJrzfcWQs7F1D3cYDUxXWTlaLIo5dGSVrc0T 35SgVTNN+Ffe6FoTdiG0VULIPAPfkk9dxOmM1Rz2jKxBvmdei22acOL/BhT4UZDmUKpKKS vKuxzQ6VBehQo3yfPiHoS36vF5+9XFVYmze4EHWkiIbK22zqJqSjoV4kFDpnnGtSCdXy56 /DZS4GJfPvZcP6vCxxa6BIBSMHuyHN+DbToq4xJhl1fzXDpALNtYdl2Zbxy8WQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664838691; a=rsa-sha256; cv=none; b=tX04gmus/WbRa9ZdbRc8Z2yttrwKOMohHTA1IqrJDZMGsSb84Q0K08jjCb2gIKtBvqDk6S rsw2R0B0XklWsYzPXl6VJKaHgCTFKOaZDVXGb9ZohvnLKCwPZCCJw673EMEtO77BO0AyUC IXu7n/zk4IZOLQ51lj9WgTbdvXqF1UzR9p2mZBQBy+XpNLVMxU1/50JT6vTb/pE9vRwAPj A0Zsl1ik42gIQ0i3H5D8t7mnPYB1JGZLX7QjXrG/qtYpLNstQ+V9T/aXyr48RCLjnnViVq VEhDphn4pM5KG2WA4Yxd6/PdJss+UD4P4KV+teC5/mkKHRet3IyS96HTUDNveQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=611cf392672cf7aa52a593412fb2537546a7d6a4 commit 611cf392672cf7aa52a593412fb2537546a7d6a4 Author: John Baldwin AuthorDate: 2022-10-03 23:10:43 +0000 Commit: John Baldwin CommitDate: 2022-10-03 23:10:43 +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 --- 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);