Checked name limits while looking up for an external attribute

Make sure the name of an attribute does not overflow beyond the
attribute length.
edge.strict_endians^2
Jean-Pierre André 2021-07-12 08:31:17 +02:00
parent f3999a74c6
commit 4e09b252af
1 changed files with 10 additions and 0 deletions

View File

@ -2835,6 +2835,16 @@ static int ntfs_attr_find(const ATTR_TYPES type, const ntfschar *name,
}
} else {
register int rc;
if (a->name_length
&& ((le16_to_cpu(a->name_offset)
+ a->name_length * sizeof(ntfschar))
> le32_to_cpu(a->length))) {
ntfs_log_error("Corrupt attribute name"
" in MFT record %lld\n",
(long long)ctx->ntfs_ino->mft_no);
break;
}
if (name && ((rc = ntfs_names_full_collate(name,
name_len, (ntfschar*)((char*)a +
le16_to_cpu(a->name_offset)),