From nobody Tue Nov 25 18:17:33 2025 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 4dG9s94x93z6HYv9 for ; Tue, 25 Nov 2025 18:17:33 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dG9s93MZ0z40sX for ; Tue, 25 Nov 2025 18:17:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764094653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gBb5wDEqxsfqivD6Try4GN3HSF9U06v5B5YslLZ0r4Q=; b=oohNhcnBTCE62fjpVE36/NcwH7z4YV5aDkrI0GPuND4AjE+AHjs9vb0vgbN/crxwLCgWa5 L3cDc6+cw6Igp0LMT1FTgCD0TmdssrNRtDQJTdbMGpkQ9SNOZSyAPX+IkwUY/izSSASKNZ YCZtf2ssXNO/Z3ryoX8bF53u96B9VHN911SneSGkm1Q7YQ4WFt6avPthFi0wVmLI158q8K 4KlYWds8/XHS0jCwHbdtfs3UmKXEZqZcV+TkMkhJCCUg3rfsBwulgKpCLD3+ee2d3D0lYA Y5vrX1mC5jwZ9KTjMtC4jZTg/mhHO/U9vcbWmhkIdPJL8JpMTT7SlfBwsVttEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764094653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gBb5wDEqxsfqivD6Try4GN3HSF9U06v5B5YslLZ0r4Q=; b=Dulr5dfosuq7IGtTDj9Knuw+wXz8TMw1dvxK0NWyGydc1iGrbwuI+ZDrYxIafHlNVz7uuU 9361oZUdmeAsXhxcYe/EviRDmzd8AhenR1vklJwOD6/Ku5UZmERIdxw9e2STOoFO+UkxTL 1gew+z1Xp06IrzVl709uq03lUuCG9L8nhVK5i/dELA/xvrbQfZ6WEOE7ciBAz3a22aoNS+ cQ+PHpXOhITnhLkrAslDZ4Y2Vdcp817RniL4ZZd3Bzb4j0N+psmbU8Cu9XHPnfBgufpdv7 nRI7deeYaQ10VksKa2eN15kR+80rNHLO+As0Ea5vGtVoZmTZemble4Qakcu/5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764094653; a=rsa-sha256; cv=none; b=MDvpIAaVs1DGoJhmTEvcMJ4xsqTOZGUcodd6Ga+H0A+3+r8mgykRk5u/DU3bD3hB+JJ6J3 loEC28eF8vm7JyOyOWEZK+FClv9iZ5m+j8lPuYv2uOEI/dsUEsFlBTs82h/7vjyZAlxrMy XuxuG/KZdy00lCtyPCsxb7LZiN7tAsJ1LqjGZuGspSmixYiNXHGCShaYMmiuaRfbE0YsA/ DVdAPJQwMWFij3O80oG06zB5aquLZgyCuxB6OOadlXb51dtvlLCxXw6kaGJIK6BDPatoA4 Nao1Q7ltIpVOCLxaIgYLk/h2U7MvU0lsP5ql48WxVvg2tr2uoTZ+V3TWzVzH/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dG9s92pM5z1BPt for ; Tue, 25 Nov 2025 18:17:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id e825 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 25 Nov 2025 18:17:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Jose Luis Duran From: Warner Losh Subject: git: 5c2ae0a209f6 - main - libefivar: Add sanity check for FilePath device path 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: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c2ae0a209f6964ebe2d3a4cc24987e3bd7f597d Auto-Submitted: auto-generated Date: Tue, 25 Nov 2025 18:17:33 +0000 Message-Id: <6925f2bd.e825.77167f91@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5c2ae0a209f6964ebe2d3a4cc24987e3bd7f597d commit 5c2ae0a209f6964ebe2d3a4cc24987e3bd7f597d Author: Jose Luis Duran AuthorDate: 2025-11-13 16:49:05 +0000 Commit: Warner Losh CommitDate: 2025-11-25 18:17:24 +0000 libefivar: Add sanity check for FilePath device path REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1497 Current implementation of IsDevicePathValid() is not enough for type of MEDIA_FILEPATH_DP, which has NULL-terminated string in the device path. This patch add a simple NULL character check at Length position. Note that the link above no longer exists. The commit message was kept verbatim. An archived version of the bug report can be found at: https://web.archive.org/web/20240714191428/https://bugzilla.tianocore.org/show_bug.cgi?id=1497 Add the const keyword to avoid errors/warnings about dropping a const qualifier. Obtained from: https://github.com/tianocore/edk2/commit/2f7a96d6ec13b292d6f31295f3195913921173e1 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1894 --- lib/libefivar/uefi-dputil.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/libefivar/uefi-dputil.c b/lib/libefivar/uefi-dputil.c index 89e049884558..74609b47a448 100644 --- a/lib/libefivar/uefi-dputil.c +++ b/lib/libefivar/uefi-dputil.c @@ -37,7 +37,7 @@ /* * Taken from MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c - * hash fd02394228ee1dc2378cccfde6098c461f96dd42 2019-Jan-31 + * hash 2f7a96d6ec13b292d6f31295f3195913921173e1 2019-Feb-21 */ /** @file @@ -137,6 +137,15 @@ IsDevicePathValid ( return FALSE; } } + + // + // FilePath must be a NULL-terminated string. + // + if (DevicePathType (DevicePath) == MEDIA_DEVICE_PATH && + DevicePathSubType (DevicePath) == MEDIA_FILEPATH_DP && + *(const CHAR16 *)((const UINT8 *) DevicePath + NodeLength - 2) != 0) { + return FALSE; + } } //