From nobody Sun Apr 28 19:43:05 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 4VSH1j54Jnz5JqVX; Sun, 28 Apr 2024 19:43:05 +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 4VSH1j4MVwz41Sp; Sun, 28 Apr 2024 19:43:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714333385; 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=8dS/I+Epmm498Cv1ttUMWC/pBo3q6kuTPmO6iZWD8Qw=; b=Kx/qlyUdombEKMXS92scDm6Gr05N9YSd42YnwK1he2GufLCLAndx1Y8PBp3nVzokPAc8Jf 3M1w1GTXVS+cSQ8sF7S8DRTVtF9/azyuFxuOQfGKD5HehW9aAZHcvATqECb6Oir901hBIY j/ZY63troRu51bUtcVLgkLsfVHGFw/z/6B8qHYSS8r/95PxAweqb9tevL7cdi8CgFsvg05 vWerH/f6hgz5Vhw0FHsYWpeW06jRsddHJPTajM9QiGDj4rV3ijPqOI/AQ57s1y84DEifcw wf9uybbQC+DLPMfm6BemftCjE7zK2QHxuTIHMm9gl7C5lE0gne6PLG4+mj313w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714333385; a=rsa-sha256; cv=none; b=wGIQre7QYkbwXSxZeOpm/baAqQ8APLSGETy7WP/7a3ERHyRWPvghbsNa+RA0c59JnrjYzG PDgbdXqilNWxrQtpHyVQxSPiOF3+WB03jl24+TJ9TOMc6yF9LbIkLW7kUNtAuMHQreRNj/ mhKvoCzjJ8lO3oR2DMSnU7vnnals+Xq6cr+kQiV5V3FzsPdjn334vN5r3Ajrxa42zyoE+X qSe/2f91rX9YUCk8avUfUIamzv43aFI/i/cmaWU/IiIq28falLYf9CZXZ2J11Awc7BUuhZ XbpZ37ILOfn2UDskWDp2xUD52A8EQVtz5aqm7QJfKUK6zZ4r7t96YExVwDFA7A== 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=1714333385; 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=8dS/I+Epmm498Cv1ttUMWC/pBo3q6kuTPmO6iZWD8Qw=; b=jtg9XnLLBp1OiMNfCe2ffFUXcWQP7161aq0xtkQf3scKNXyXBMkT3qjImKNi+4NOnqmOzA fXdn/E7Xs+AfrHGVHPgukSe2Wwjk7BuL5KnhkwnZUNCO3sFNHAvy1BmV0exqKo7fvWYcy2 gB6Wz/ZlAlcMV1s2JEyVUSKZZkdnYK8xT+wIcLG+Q2J1fVayT4YqjLvqAsXU2qYS0SxZrW h871GaHfF4MFpj3kIwLFbGUElFKppQHavk3/zlWVpDAoEFXI7RaTy4MapGoRoaXP7dK7qr hQOOIC3AeAJJKeZHvpDAbgjiXJlbivahSSsOcygKvfOKdTSlGOzRByxtsku11Q== 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 4VSH1j3z8zzfKs; Sun, 28 Apr 2024 19:43:05 +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 43SJh5BP061930; Sun, 28 Apr 2024 19:43:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43SJh5Ip061927; Sun, 28 Apr 2024 19:43:05 GMT (envelope-from git) Date: Sun, 28 Apr 2024 19:43:05 GMT Message-Id: <202404281943.43SJh5Ip061927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 56ee5fc43c40 - main - rtld snprintf: do not erronously skip a char at the buffer boundary 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 56ee5fc43c40479e2651b21862e299bcf73017ae Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56ee5fc43c40479e2651b21862e299bcf73017ae commit 56ee5fc43c40479e2651b21862e299bcf73017ae Author: Konstantin Belousov AuthorDate: 2024-04-28 06:37:24 +0000 Commit: Konstantin Belousov CommitDate: 2024-04-28 19:42:12 +0000 rtld snprintf: do not erronously skip a char at the buffer boundary Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44987 --- libexec/rtld-elf/rtld_printf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libexec/rtld-elf/rtld_printf.c b/libexec/rtld-elf/rtld_printf.c index 07598c73c6d4..befac1c547b7 100644 --- a/libexec/rtld-elf/rtld_printf.c +++ b/libexec/rtld-elf/rtld_printf.c @@ -81,11 +81,10 @@ snprintf_func(int ch, struct snprintf_arg *const info) } break; case PRINT_METHOD_WRITE: - if (info->remain > 0) { - *info->str++ = ch; - info->remain--; - } else + if (info->remain == 0) printf_out(info); + *info->str++ = ch; + info->remain--; break; } }