From nobody Thu May 02 09:08:28 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 4VVSlc2dPlz5Jdvw; Thu, 2 May 2024 09:08: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 4VVSlc1nTfz4jmG; Thu, 2 May 2024 09:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714640908; 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=a8Rjzbve9bTOcKiYt/9DTOtPyhYgX26pn/WOabqLsSo=; b=A4ASZIMe5G1QePY45Gv+Drk4IW2LFX3CW5526Oizi0FSQLQ3BtLs39EgPR0zNB8PBDTw2G bXTDyBl2Ok32TSiVYPnaWTSgAfrjPcPPvmHpoxvTLL3Dy3/gAOl9ijdMQSLGjpZFSNhE+b /vrIKf7wDWE+hmDDCd1TMHEhdRB+BiXLYR2uQQPtn1vmXFZYSubtl9Z52aNFC95z9KJvaI IfIQWFHsCVeUhIi49ngXnXiTYf58ojobClJfRejdaafXi9RE+x+GU4z1AyRaCNkFGhrxgU 7YQ5AbDmGm8GXvzpHMkAso1k34tOZVY4g3HWb2ox+V/z9xZcEKsogbKVkpJCYw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714640908; a=rsa-sha256; cv=none; b=a+S3j86sHrJOUcIigQvZPSUx9QbFZv2NRGwb6ZCz7lkAxg/oUmEAFS5pbX1KeMC/MMV1Dx dAkWSwxcn6l5iLt7UNO9m+CgjnfnymHllZeKMza0L7TmEnTC+MTiz4LWKloTZ/YyfE/+NN R+pVt73jgzAz0EgcWt1v88Zzb7g3gU3XIWcapndSUwcRZVChZMVh3SGpX64fPkEhuQvmqa MUBlHHBtO11AhromE4ja+H4pBwZ8t2fVn9BhFQxKIJzYR8fGm3LiWSPj1Hhb4wONWvSoH8 HC6/dLF+tBvX7aoooEpZoKWIhp/BAH7GFTvkWwU3NDRX+yK91IZ4Y5EIhed1jg== 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=1714640908; 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=a8Rjzbve9bTOcKiYt/9DTOtPyhYgX26pn/WOabqLsSo=; b=MbzpCdUmz3f8bvCaNeYsh61MpiXypOVWWeSFgeoDSa2PKNZvsjxXnMeVhfDETr1FE9nDZo minASpFvw8vNKK9gWctYMazVBb5sUghkJsOc5qiLIKTFqtmYfKiOHotZA7Z62Hve1nz0SG E4kVLpf1oIRXKjpucxlKFpitjOuk1SA8wKqorLEppWIE7cSymS4z9A9QPKUk1Gl8jNck+E PXVEpFlQWwH27rVEHB6NfVoTojXjIrP3cnReg0l0FKqTUtuEqGg5YvsT+B1JI2qdS+yqF0 e3MT5M8xB0lOoQtVjRE/snWkhYo8hTHnD7yytyGD5jaV6aDBjMJS6KKrB4VusQ== 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 4VVSlc1NW3zwPN; Thu, 2 May 2024 09:08:28 +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 44298SK6040192; Thu, 2 May 2024 09:08:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44298SDm040189; Thu, 2 May 2024 09:08:28 GMT (envelope-from git) Date: Thu, 2 May 2024 09:08:28 GMT Message-Id: <202405020908.44298SDm040189@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: 2bdfc2988986 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 2bdfc2988986461bac0c28fb6fdc4ee99e421c6c Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=2bdfc2988986461bac0c28fb6fdc4ee99e421c6c commit 2bdfc2988986461bac0c28fb6fdc4ee99e421c6c Author: Dag-Erling Smørgrav AuthorDate: 2024-04-29 10:11:12 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2024-05-02 09:08:17 +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); }