From nobody Sun Jan 28 13:20:58 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 4TNBrp64lvz58ZFC; Sun, 28 Jan 2024 13:20:58 +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 4TNBrp5K3Lz51DX; Sun, 28 Jan 2024 13:20:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706448058; 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=bm2jPUhvJPoArOJxJAejge5L6KZxvlW8OHQUDJVZxOQ=; b=htXFN2Zs02a9rtvfWmFjUCeLBhRei1F4VFoflqFACt6mhE4urGONPDeRD7tVxV21L6UpWb S99m1YILZNPucHgAPNs3a/4iEQ1yhwq2N4kgBJlNggvIFP+pZ04vDOsnQRrIIyle0/DJEF pMVKng2iW7dQdYx0L7eKvdbMaOSsw1WlU1ITXPPkj0yIGoeT2iw5Z6cqeo9s9MOi/5nZ8Q W4wlWPCVJig0rb5FCv762qtPbDV1Zhr+CDXPyAkLcje0kzW78vvinIWvQvBYiBCUA0/Z4b 2a8lEsp3bnysMsAsf0vKJhp4qs3LCRDYx8GaoWsmFQQh8T/WElRSr9wZKMX1vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706448058; 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=bm2jPUhvJPoArOJxJAejge5L6KZxvlW8OHQUDJVZxOQ=; b=YvzBSZpbMiAaEUYHUI0324YgbUaIiVBe7yRCwZJo1BiPxLOMgpnRLpvFE2IGuCA8wnt4X6 6KQqlf88XfTGfkN+8tAAy+T+F1UkeWOjc2JwQqjrrRexVaLbjrd78+EEcXgoGXhaU8O2UG R+MM6yREa1MTkYvXa8xpY7oTlF/PwZiKhvytWNfpTR2WBT6LH8BRx/jjEdLc/L2p91xQyF IMT7rPOt6VGK8Y+blJIwC51I+qB0hTEOT73LZd9v10VCzuVsI3EcwTLIvP51xKNJcGH0+a vrm2Nr3N0yp9iR/PS0aICYrKO3J4aRKXcAx3Sr2wZJK0TTe1FJiTs04oWJnscw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706448058; a=rsa-sha256; cv=none; b=v52O4a0k6wnoFCPRt/0EmDHlyLPij7xnw3Lw1c/x4AWoo+9X+rzvH+13EF1Syn6XyTBknT L58lOkfkeYjovgAZUd6DLEGorEoS6RcQf7TOCP3bUDWmm7XN01GLoa0T4wOr5imUXlbXyW /2rYV2ljMsND7+ITGCLqtt4+GV9o1RCFQ5jHY2qYKrH4d+BG9KN7wAEdfP0TJl4Cd5eIhs ctyKCGOi8vUxFWurg9DlcKUtZWp2lXWOdcwyA0Ed4Ddz6+MT/0tjzn2e8eCTW3zSKywQ4z DYbc/T9/nx7kn5x+TFvEJ/H5yEQ6sE53zjiVSzub0hM1IE2yjzes+i/ZgBIFpQ== 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 4TNBrp4MYrz183w; Sun, 28 Jan 2024 13:20:58 +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 40SDKwfX050640; Sun, 28 Jan 2024 13:20:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40SDKwXt050637; Sun, 28 Jan 2024 13:20:58 GMT (envelope-from git) Date: Sun, 28 Jan 2024 13:20:58 GMT Message-Id: <202401281320.40SDKwXt050637@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: bf87d4a4bfaa - main - 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/main X-Git-Reftype: branch X-Git-Commit: bf87d4a4bfaa86e97079754e93fe14595adf07c5 Auto-Submitted: auto-generated The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=bf87d4a4bfaa86e97079754e93fe14595adf07c5 commit bf87d4a4bfaa86e97079754e93fe14595adf07c5 Author: Andriy Gapon AuthorDate: 2022-10-25 21:10:39 +0000 Commit: Andriy Gapon CommitDate: 2024-01-28 13:20:29 +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. --- 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 4a6a7fdfec39..7bcb4674586b 100644 --- a/usr.sbin/efibootmgr/efibootmgr.c +++ b/usr.sbin/efibootmgr/efibootmgr.c @@ -790,6 +790,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);