From nobody Mon Apr 29 10:11:43 2024 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 4VSfHz59Twz5J0ND; Mon, 29 Apr 2024 10:11:43 +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 4VSfHz4fkjz4j9V; Mon, 29 Apr 2024 10:11:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714385503; 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=dCHnr1z7+grLqH/JC3A0ZRgQjE21sqB+KeSqZs/1yMA=; b=Gtq5y60mnx5JOM9qYNjFoY/nwq/enIw95x61LY+cED5HnMPyqO3GG/R8pRW/QZVTcmIwb+ erP4Hul/W3zYaJ4OsBawFQdugmo1/Kn70g8bb5pmC7TmR85cbGqcGL5CsdOXRENDASLneK 3TbxO4FWVCsLbjtgVj4XGx+pQwUYdjk11hWSD91/T2Xh2P8AyNa3Wpkllz0ESEeewimLL/ QM5M8mGgNzDWZzXQ0jwtRgAfEgSaB6f3Rq67XH04RLR7+WtyJWTPbT1b0xG3LpI4GkDli2 eK1TskTUfG5g5AdLfNr/LxPFJglCFdwQ65ax+24SJjA45swc35XaFgRKE1VKIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714385503; a=rsa-sha256; cv=none; b=pbpxNZt6Az+pnaIjocbJhfhB4NufkT/Fj45ZsemR4yYMlbkViCB4C7UEDVUhyF0g36T5br 4UtE1BSAC7S8KQSLSA+RGJBIwVfITmJ+hvHUq0VJ3p56LfjddDxJKHhatgc/on7VCcCGM5 IWD3PQHv0cZFKQvLLY0bV6DBsaplxYY75jCzfGkuXgUv2QIenrn9X1dgETjTN5yQni99EL /VikIbmA4zbHEDB4NIf/+31v87/OYNm/6ZXyY10+bgr2XyTv5GlJyPfhAdQ9H0o26peU8f 11GD5BHqXrgNVk+XQnea+pUQ+X0TVGLlL51GMDrAzWi7jtJM4+PuN7gwAbiXdw== 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=1714385503; 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=dCHnr1z7+grLqH/JC3A0ZRgQjE21sqB+KeSqZs/1yMA=; b=U9AmPBxEDcOJisdgBnEApjaxXHvRlIbjcPTABUy0CmpKXQPpE8y2WIImqnMvjLhbKp+J63 XmIG0IHdG6z9ZMLPPDelK7f3/7dBGwuIIZ6im1w/pTyHPW0wkvjR0gpPYZxi+3hmDTiuqX v7bdAbRckgW2JzNgDvMaSH5eWf0HIWz/6QsVDj5Qaf/2lis1jHlePIDpmiQKTaHoEmlfaY czkcuCk3R6Lhgq1GP4Ikt1Y3Oe+97b6ybmeSIU30yzYEt2GwOoPoYBndDnJXo5/ayMHIbI ut0eftHhEgGcMV0cOMIzT4iDZLTk7m/nfE1ds/pE9T8yRdIdbKghMDQsn/RiQg== 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 4VSfHz4GCBz14lL; Mon, 29 Apr 2024 10:11:43 +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 43TABh35033002; Mon, 29 Apr 2024 10:11:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43TABh0Z032999; Mon, 29 Apr 2024 10:11:43 GMT (envelope-from git) Date: Mon, 29 Apr 2024 10:11:43 GMT Message-Id: <202404291011.43TABh0Z032999@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: c28253ecde33 - main - libulog: Make sure ut_line, ut_user, ut_host are terminated. 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: c28253ecde333c9908b7160664805acc3a92e2b0 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=c28253ecde333c9908b7160664805acc3a92e2b0 commit c28253ecde333c9908b7160664805acc3a92e2b0 Author: Dag-Erling Smørgrav AuthorDate: 2024-04-29 10:11:12 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2024-04-29 10:11:37 +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 --- 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 c51c56a31f4a..103543458485 100644 --- a/lib/libulog/ulog_login.c +++ b/lib/libulog/ulog_login.c @@ -49,7 +49,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); @@ -66,9 +66,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); }