From nobody Mon Feb 9 01:16:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+99147+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+99147+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1674811799; cv=none; d=zohomail.com; s=zohoarc; b=ge+fm09Y8GUNC22EbyxVowF3zBe2D/gIW3C06ES5GRbLt21KOaLQh50ISX7btNU563yzYbMTeuxU+dWZkivJeEED/fgnEzerzwoBuVI2BazLhGceieI9WyzsOer8Qu0hHedytKgkk+PrXs2MkF7DqhhCg7N8HY5dF7xXtCNl6IQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674811799; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=4uecp6Kg8rcGEkDG2wcsZE5Qy1qQdKOBCB908vEd5RY=; b=md2r3+WOtgTjUbM2gDekjBzJWWFuklrFo6AZyRGlOSZmxguIFgvgQj5OTqU5EKoPIRCTtxVlntAKMs9mqzUXNCWqUqcXF7nJk5ngadykRPNSWDywV4HqJ14ANQj9c594StC6GkJ64xGHCjiNcGOjfM7mCxxqB6KdjLS1MCjABzQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+99147+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16748117992431015.3584276358164; Fri, 27 Jan 2023 01:29:59 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4oBcYY1788612xbNBmWYD25K; Fri, 27 Jan 2023 01:29:58 -0800 X-Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by mx.groups.io with SMTP id smtpd.web10.98483.1674811796503971478 for ; Fri, 27 Jan 2023 01:29:58 -0800 X-Received: by mail-lf1-f43.google.com with SMTP id br9so7244308lfb.4 for ; Fri, 27 Jan 2023 01:29:57 -0800 (PST) X-Gm-Message-State: cqEG6xEukMF49gJh72XHjPhux1787277AA= X-Google-Smtp-Source: AK7set+4JKaWx5iKroDE4ssUnMBoTiyWI3RzlAUuIskP2LUKekFcuTRmAZl1lD7mlL6d3pBkm7NZpg== X-Received: by 2002:a05:6512:3986:b0:4d8:57dc:fcdd with SMTP id j6-20020a056512398600b004d857dcfcddmr114281lfu.56.1674811797391; Fri, 27 Jan 2023 01:29:57 -0800 (PST) X-Received: from localhost.localdomain ([176.62.67.29]) by smtp.gmail.com with ESMTPSA id t11-20020a056512068b00b004cc8196a308sm229071lfe.98.2023.01.27.01.29.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 27 Jan 2023 01:29:57 -0800 (PST) From: "Savva Mitrofanov" To: devel@edk2.groups.io Cc: =?UTF-8?q?Marvin=20H=C3=A4user?= , Pedro Falcato , Vitaly Cheptsov Subject: [edk2-devel] [edk2-platforms][PATCH v3 11/11] Ext4Pkg: Filter out directory entry names containing \0 as invalid Date: Fri, 27 Jan 2023 15:29:45 +0600 Message-Id: <20230127092945.94389-12-savvamtr@gmail.com> In-Reply-To: <20230127092945.94389-1-savvamtr@gmail.com> References: <20230127092945.94389-1-savvamtr@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,savvamtr@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1674811798; bh=FJCP2YNkeZ5Dd8Io6CVU0i07XDk8A0UDPSYWH8q9p5w=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=W/1qPoEZRhDQkwIPf13BNo2JADfhDGcjevfcoreZAS04znobwMz/g+Hgc/v88fHMxm1 YNGQX1B3xJ3OJFfwuiRdN/zgs7xwpA4ixS2vxvC1ajn102tcifuGQK+dJPPcwEeQGanR6 7Nipcn+XJaldIdzObfrRHpwhXLgmQVlFxZI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1674811800661100042 Content-Type: text/plain; charset="utf-8" The directory entry name conventions forbid having null-terminator symbols in its body and can lead to undefined behavior conditions and crashes Cc: Marvin H=C3=A4user Cc: Pedro Falcato Cc: Vitaly Cheptsov Fixes: 89b2bb0db263 ("Ext4Pkg: Fix and clarify handling regarding non-utf8 = dir entries") Signed-off-by: Savva Mitrofanov Reviewed-by: Marvin H=C3=A4user Reviewed-by: Pedro Falcato --- Features/Ext4Pkg/Ext4Dxe/Directory.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c b/Features/Ext4Pkg/Ext4Dx= e/Directory.c index 0753a20b5377..465749c9b51d 100644 --- a/Features/Ext4Pkg/Ext4Dxe/Directory.c +++ b/Features/Ext4Pkg/Ext4Dxe/Directory.c @@ -28,9 +28,16 @@ Ext4GetUcs2DirentName ( { CHAR8 Utf8NameBuf[EXT4_NAME_MAX + 1]; UINT16 *Str; + UINTN Index; EFI_STATUS Status; =20 - CopyMem (Utf8NameBuf, Entry->name, Entry->name_len); + for (Index =3D 0; Index < Entry->name_len; ++Index) { + if (Entry->name[Index] =3D=3D '\0') { + return EFI_INVALID_PARAMETER; + } + + Utf8NameBuf[Index] =3D Entry->name[Index]; + } =20 Utf8NameBuf[Entry->name_len] =3D '\0'; =20 --=20 2.39.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#99147): https://edk2.groups.io/g/devel/message/99147 Mute This Topic: https://groups.io/mt/96562701/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-