It is not so important from my point of view, however, I corrected this in the 
referenced repository fork.

> On 27 Jan 2023, at 16:04, Marvin Häuser <mhaeu...@posteo.de> wrote:
> 
> On 27. Jan 2023, at 10:29, Savva Mitrofanov <savva...@gmail.com> wrote:
>> 
>> 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äuser <mhaeu...@posteo.de>
>> Cc: Pedro Falcato <pedro.falc...@gmail.com>
>> Cc: Vitaly Cheptsov <vit9...@protonmail.com>
>> Fixes: 89b2bb0db263 ("Ext4Pkg: Fix and clarify handling regarding non-utf8 
>> dir entries")
>> Signed-off-by: Savva Mitrofanov <savva...@gmail.com>
>> ---
>> Features/Ext4Pkg/Ext4Dxe/Directory.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>> 
>> diff --git a/Features/Ext4Pkg/Ext4Dxe/Directory.c 
>> b/Features/Ext4Pkg/Ext4Dxe/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;
> 
> I *really* do not like UINTN in code that does not deal with buffer addresses 
> and sizes. I'd change it to UINT8, but I'll leave it up to Pedro.
> 
>>  EFI_STATUS  Status;
>> 
>> -  CopyMem (Utf8NameBuf, Entry->name, Entry->name_len);
>> +  for (Index = 0; Index < Entry->name_len; ++Index) {
>> +    if (Entry->name[Index] == '\0') {
>> +      return EFI_INVALID_PARAMETER;
>> +    }
>> +
>> +    Utf8NameBuf[Index] = Entry->name[Index];
>> +  }
>> 
>>  Utf8NameBuf[Entry->name_len] = '\0';
>> 
>> -- 
>> 2.39.0
>> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99291): https://edk2.groups.io/g/devel/message/99291
Mute This Topic: https://groups.io/mt/96562701/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to