Fixed the detection of the end of attribute list

The recent detection of a truncated attribute list entry overlooked the
normal detection of the end of list. Moreover the check for name
overflow is to be done later and not needed at this stage.
edge.strict_endians^2
Jean-Pierre André 2021-07-26 08:49:45 +02:00
parent a337c4c1eb
commit 1261e6b60a
1 changed files with 5 additions and 4 deletions

View File

@ -3092,10 +3092,11 @@ static int ntfs_external_attr_find(ATTR_TYPES type, const ntfschar *name,
al_entry = (ATTR_LIST_ENTRY*)((char*)ctx->al_entry +
le16_to_cpu(ctx->al_entry->length));
if ((al_entry->name_length
&& ((u8*)al_entry + al_entry->name_offset
+ al_entry->name_length * sizeof(ntfschar))
> al_end))
if ((u8*)al_entry == al_end)
goto not_found;
/* Preliminary check for small entry */
if ((p2n(al_end) - p2n(al_entry))
< (long)offsetof(ATTR_LIST_ENTRY, name))
goto corrupt;
/*
* If this is an enumeration and the attribute list attribute