From owner-dev-commits-src-branches@freebsd.org Tue Feb 16 02:25:28 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B54C854514F; Tue, 16 Feb 2021 02:25:28 +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 4DflF44llSz4cNr; Tue, 16 Feb 2021 02:25:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 95A79B24; Tue, 16 Feb 2021 02:25:28 +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 11G2PS4I037830; Tue, 16 Feb 2021 02:25:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11G2PSBG037829; Tue, 16 Feb 2021 02:25:28 GMT (envelope-from git) Date: Tue, 16 Feb 2021 02:25:28 GMT Message-Id: <202102160225.11G2PSBG037829@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 5ab679d9619a - stable/12 - inetd: fix unix sockaddr's length assignment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5ab679d9619afe8242200bdb4f0391b6fd405e25 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 02:25:28 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5ab679d9619afe8242200bdb4f0391b6fd405e25 commit 5ab679d9619afe8242200bdb4f0391b6fd405e25 Author: Kyle Evans AuthorDate: 2021-02-12 19:19:43 +0000 Commit: Kyle Evans CommitDate: 2021-02-16 02:25:06 +0000 inetd: fix unix sockaddr's length assignment unsz was always exactly '1' here due to an unfortunate mispositioning of closing parenthesis. While it's generally irrelevant because bind(2) is passed the (accurate) sep->se_ctrladdr_size instead, it's not very helpful for anything locally that wants to use it rather than assuming that sep->se_ctrladdr_size perfectly fits the end of sun_path. Just drop unsz entirely and use the result of SUN_LEN() for it. (cherry picked from commit 1253835121cb38fd93478849e32a4a4c13436fb2) --- usr.sbin/inetd/inetd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index 7ba51c9af593..6c4e26fad5cd 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -1624,7 +1624,6 @@ getconfigent(void) int v6bind; #endif int i; - size_t unsz; #ifdef IPSEC policy = NULL; @@ -1852,16 +1851,16 @@ more: #define SUN_PATH_MAXSIZE sizeof(sep->se_ctrladdr_un.sun_path) memset(&sep->se_ctrladdr, 0, sizeof(sep->se_ctrladdr)); sep->se_ctrladdr_un.sun_family = sep->se_family; - if ((unsz = strlcpy(sep->se_ctrladdr_un.sun_path, - sep->se_service, SUN_PATH_MAXSIZE) >= SUN_PATH_MAXSIZE)) { + if (strlcpy(sep->se_ctrladdr_un.sun_path, sep->se_service, + SUN_PATH_MAXSIZE) >= SUN_PATH_MAXSIZE) { syslog(LOG_ERR, "domain socket pathname too long for service %s", sep->se_service); goto more; } - sep->se_ctrladdr_un.sun_len = unsz; #undef SUN_PATH_MAXSIZE - sep->se_ctrladdr_size = SUN_LEN(&sep->se_ctrladdr_un); + sep->se_ctrladdr_size = sep->se_ctrladdr_un.sun_len = + SUN_LEN(&sep->se_ctrladdr_un); } arg = sskip(&cp); if (!strncmp(arg, "wait", 4))