From nobody Thu May 2 09:08:46 2024 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 4VVSly372xz5Jdxq; Thu, 2 May 2024 09:08:46 +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 4VVSly2Zb1z4jws; Thu, 2 May 2024 09:08:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714640926; 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=+rvwvxZQvFvJRsvfJcgCr5N1MoiTMyicI7JWsKQbpsQ=; b=ejPmxbGGE5jLF6XUpOA+T+0HUq3zlHkcpShG3RGZGzqRoA+8/wFcPG2wJUg/Troes9rdIE cxzgnVcTtpkkeKDXU3xg6tmxkS9x/7loBkYi4+EDoTyECBYTMiX88Dk7c2lwViQaZoxUnQ fMdyeuAaLcMA/uwsp/whKjdkWna86X2yM2nmd6V2SivQJ9UK1/99vXttqfhJpeAdDlyWee 6VBrnwXqf4DGYUAIahC+FpqbeeEcMVvqPFSpWb4TmA3UOKG4p6tCQvO8RGt3YekdMeI5XB E7biEBEq8gNWTPhMN6cE7YWQkRiquMMJ1Mmv0AsXYwW1iW4psbzNOyGEzageOg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714640926; a=rsa-sha256; cv=none; b=gSi6SVJqyf8XsE/o7ASrcoLDVnKj4xgEc3fzK5um+hA9mXzl++fcd9U2d3YgCZfaopEERU Sgq9Hv203SHmf2uXJ00vRaLy7+XYNtSvAgHj0qZZeeGJusdLo2U7QkuLOr0wiOC0cJjfqz 42u6K5lN4t0HSAlTcTgbaMTDrZPCi0rkLRMAGEWuTXoQItZ+Cxrk6zxgWzYcFg7iPDNSXl YhpKH4YxdAs4OBb52nkvnAmt9kw0lQpsEHZqKDzMmTcFIUOMmmC2RzP+oq5TZSjsYglJaz I8+noIJbR25AjDXylHH2hYaFqtKCucxWsnfNMCywaklsDxSQiydOjdfBFkp8Zw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714640926; 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=+rvwvxZQvFvJRsvfJcgCr5N1MoiTMyicI7JWsKQbpsQ=; b=QjvtEt0u/P7dReFC2jVAqu+vyc/GuO75Bqf6SDB3cnhD1zVg+5UjCHpmlpCXeiJk3dLLl5 oAU7YJqutPYMRtDfZC0yV0+UDuceIXW/8whfIGP2Xt1kYoJ0JcoSpoY8+kL7mNSWLY56qk iZ1/0cZXWwAP2M8hxoYfEdk0dEIv6YXmre3P7QSY1jcYT1FEMomBZ+XlU4BC49liAvgd1l ChM8TU26KrqUaRS8dr4oeCSB45gidWPlIa8JQqzosMFY8FT7lEKTvJ+tGH4Z13Q1gSejo1 JF5fcHvHn7fG9ghISuAEvnB/nstWVsgU3g4q8uxmwTDYypojJ/TJa/HHASh8mw== 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 4VVSly29ljzwdy; Thu, 2 May 2024 09:08:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44298kcH040393; Thu, 2 May 2024 09:08:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44298kAj040390; Thu, 2 May 2024 09:08:46 GMT (envelope-from git) Date: Thu, 2 May 2024 09:08:46 GMT Message-Id: <202405020908.44298kAj040390@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 3f59eb314103 - stable/13 - libulog: Make sure ut_line, ut_user, ut_host are terminated. 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f59eb314103869e3f54468cf2a2b4464bd8a484 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=3f59eb314103869e3f54468cf2a2b4464bd8a484 commit 3f59eb314103869e3f54468cf2a2b4464bd8a484 Author: Dag-Erling Smørgrav AuthorDate: 2024-04-29 10:11:12 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2024-05-02 09:08:36 +0000 libulog: Make sure ut_line, ut_user, ut_host are terminated. MFC after: 3 days Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D45004 (cherry picked from commit c28253ecde333c9908b7160664805acc3a92e2b0) --- lib/libulog/ulog_login.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libulog/ulog_login.c b/lib/libulog/ulog_login.c index dc08ac7d331d..adf6bdbb7489 100644 --- a/lib/libulog/ulog_login.c +++ b/lib/libulog/ulog_login.c @@ -50,7 +50,7 @@ ulog_fill(struct utmpx *utx, const char *line) utx->ut_pid = getpid(); gettimeofday(&utx->ut_tv, NULL); - strncpy(utx->ut_line, line, sizeof utx->ut_line); + strlcpy(utx->ut_line, line, sizeof utx->ut_line); SHA1_Init(&c); SHA1_Update(&c, "libulog", 7); @@ -67,9 +67,9 @@ ulog_login(const char *line, const char *user, const char *host) ulog_fill(&utx, line); utx.ut_type = USER_PROCESS; - strncpy(utx.ut_user, user, sizeof utx.ut_user); + strlcpy(utx.ut_user, user, sizeof utx.ut_user); if (host != NULL) - strncpy(utx.ut_host, host, sizeof utx.ut_host); + strlcpy(utx.ut_host, host, sizeof utx.ut_host); pututxline(&utx); }