From nobody Sat Feb 17 15:12:31 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 4TcXNJ15yMz5BFrq; Sat, 17 Feb 2024 15:12:32 +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 4TcXNH5fr4z4YHP; Sat, 17 Feb 2024 15:12:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708182751; 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=EMYtqtJ6WaoD0Fc7kkOIlYdmSheXpPzOoVHBWHsEQjM=; b=XlZeq+xNaxf55G+l1/OSCaxQPegRP79EJtP9VNgVNIczOk47zIznZDu2ATzsm+ewlOevWj +MsiTmZAFF6uv0AhF4fc/vhUT5CR9p/poiQU0MKlDw6atLy3udkHBmtdw7cG7D1wVcQpAC vutDbWhxvafs18v1eHXf8B/o/Ybfb8nyhuhv3tpGHyHi9acmsGZDHUbg8pbpbyg9WDe+sF 6MPcLDhaQDtJeYukADtHVhuvhncw9ZKRFflqWJOgCL9DdPC3p66R2BABRRlKlyeje2E8za E2l6mxHUXe7uwB+JclcmtevDHd30Y/eJtR7LbnL/qY+424JqvqoOtc7NxDTRBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708182751; 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=EMYtqtJ6WaoD0Fc7kkOIlYdmSheXpPzOoVHBWHsEQjM=; b=FqyN9vKGBtmiTleaOyjZ62TauDhPsPcskD/m+qlc0tQZ0H8RtqEFoesjNSBKsP8rXST+5m J2xDJ+03FkQdRxCrWsUHijY6eqxYMKU2OU5VtmBvrc5LjMEhb93hPV4VbMjS/Djl6bLbl7 kxEmp9IS9NidHiTczv7lr+YDVwVCPo1G6abm2pxm33vbWb1xM289dMtcCVEeR6ET8nA4iP VHudbuVxbCA/x+hgs45Yol/Otsew0mGMwpMP6poPX1llDA3vVklrMiLZsPWEfMkXUUxxLC OULj5vtuNyJOyUAS6Lie69u3tEr7yb59/VZzBJiKJdMNRsGn3da+XhCqQNIURw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708182751; a=rsa-sha256; cv=none; b=kNjq+ozq0rlLJzsbAUrZ/cMIlt/+pCBeSNjD1f7i79+tpAZy+jgxbnZsjhmj5JvSIB8eYU izSxU5fpNCdiUhvYDfPbR5kPnmk8tna/dLiU8jMksmjeZSEVs00ja4B9upFRiyY48pN4A4 yq2eLdRH37MigYmTYVxKC+qtfL5+Wl8QRZoU+GBa59BqIihNomme9sZpHqWdO23SbTwAEO 6e9F6Qbh2Fqp4HDo/xZmy6y5S01wEJN/ss73e42MDOKusOIGyec1+JoUTJR8A6Ur3Whily zEiSHTpkYCxPDhyzOvxFzgWQoZXB34WgYHeF+OaCVWT4t+OHl/v453+d5XrBVA== 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 4TcXNH4msDz1CQn; Sat, 17 Feb 2024 15:12:31 +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 41HFCVVb080909; Sat, 17 Feb 2024 15:12:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41HFCVYP080906; Sat, 17 Feb 2024 15:12:31 GMT (envelope-from git) Date: Sat, 17 Feb 2024 15:12:31 GMT Message-Id: <202402171512.41HFCVYP080906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 191462cb674c - stable/14 - efibootmgr: fix potential endless loop with -v 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 191462cb674c092de392aa8e31054115d9aa74f8 Auto-Submitted: auto-generated The branch stable/14 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=191462cb674c092de392aa8e31054115d9aa74f8 commit 191462cb674c092de392aa8e31054115d9aa74f8 Author: Andriy Gapon AuthorDate: 2022-10-25 21:10:39 +0000 Commit: Andriy Gapon CommitDate: 2024-02-17 14:18:04 +0000 efibootmgr: fix potential endless loop with -v I observed the problem on a system with fairly old and, apparently, buggy EFI implementation. A list of boot devices had an invalid trailing entry. efidp_size() for that entry returned zero, which means that the code got stuck looping on that entry. (cherry picked from commit bf87d4a4bfaa86e97079754e93fe14595adf07c5) --- usr.sbin/efibootmgr/efibootmgr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c index 8dcf9876486d..be1157b4aa84 100644 --- a/usr.sbin/efibootmgr/efibootmgr.c +++ b/usr.sbin/efibootmgr/efibootmgr.c @@ -784,6 +784,8 @@ print_loadopt_str(uint8_t *data, size_t datalen) */ indent = 1; while (dp < edp) { + if (efidp_size(dp) == 0) + break; efidp_format_device_path(buf, sizeof(buf), dp, (intptr_t)(void *)edp - (intptr_t)(void *)dp); printf("%*s%s\n", indent, "", buf);