From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by mx.groups.io with SMTP id smtpd.web11.11623.1675333810169550779 for ; Thu, 02 Feb 2023 02:30:10 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.de header.s=2017 header.b=Ieps0OFT; spf=pass (domain: posteo.de, ip: 185.67.36.66, mailfrom: mhaeuser@posteo.de) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 65BB72406C8 for ; Thu, 2 Feb 2023 11:30:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1675333808; bh=WvQC5WdcFdOmjxeVukSXp1mOiwh6ZaDqOSjR8bS4Cu0=; h=From:Subject:Date:Cc:To:From; b=Ieps0OFTFtFSgh9kx9rr3B3OdVeBmXkai+Lq5NeielNIt7I1S5tsJza7j0kvTczf1 zblPWA1BJDRqcV1kJzRwaKUN/BouQhiXLSAohYPfPBswGjb4z1hVFLtLTAZWwU7fJL /KwI39z7wQoULmQhKNFaZPXTOmr+V+caIj4h4FbbBre9JEDZqRZH8ZF46ARMiVkUfp 2fkB+1UKvqrtsBBA4PRtNR89qDqSBMbkZb2We7CkVM498PjSB7Wfn2jK9Zan48OtRU lDgXeS+D4HUhxzAp+nQTrMmtC42cFJyct9XQW8qTYjlx/rR2jqO3WpA2UYPRzeRu/j oMasstuKQbUzg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4P6w5q4H58z6tmJ; Thu, 2 Feb 2023 11:30:07 +0100 (CET) From: =?UTF-8?B?TWFydmluIEjDpHVzZXI=?= Mime-Version: 1.0 (1.0) Subject: Re: [edk2-platforms][PATCH v4 11/12] Ext4Pkg: Filter out directory entry names containing \0 as invalid Date: Thu, 2 Feb 2023 10:30:07 +0000 Message-Id: <6B3BC377-63FC-49BC-8161-B1B889FDEDC0@posteo.de> References: <20230202102133.51606-12-savvamtr@gmail.com> Cc: devel@edk2.groups.io, Pedro Falcato , Vitaly Cheptsov In-Reply-To: <20230202102133.51606-12-savvamtr@gmail.com> To: Savva Mitrofanov Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Reviewed-by: Marvin H=C3=A4user > On 2. Feb 2023, at 11:21, Savva Mitrofanov wrote: >=20 > =EF=BB=BFThe directory entry name conventions forbid having null-terminato= r > symbols in its body and can lead to undefined behavior conditions > and crashes >=20 > 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: Pedro Falcato > --- > Features/Ext4Pkg/Ext4Dxe/Directory.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c b/Features/Ext4Pkg/Ext4D= xe/Directory.c > index dee8cfc66cb7..88f89a40534c 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; > + UINT8 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.1 >=20