Re: [PATCH v3] ntfs: validate non-resident attribute offsets
Namjae Jeon <[email protected]>
| Newsgroups | dev.linux.lists.ntfs,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <CAKYAXd91TzMghrpOG4pBYr-9UBY9qJ6by=mrkS0m4BxMZEbrHg@mail.gmail.com> |
> + /* Ensure there's room for the compressed_size field if needed. */ > + if (!(a->flags & ATTR_IS_SPARSE) && > + !(a->flags & ATTR_IS_COMPRESSED) && > + attr_len - mp_offset < sizeof(a->data.non_resident.compressed_size)) > + return false; Sorry for the confusion. I rechecked the code and realized that ATTR_COMPRESSION_MASK is correct here. It covers the entire compression field, while ATTR_IS_COMPRESSED checks only the 0x0001 bit. Since this validation checks whether the attribute layout includes compressed_size, it should use the mask, consistent with the existing min_len check. So I have applied the previously attached patch. Thanks!