Unverified Commit 0addfb1c authored by Konstantin Komarov's avatar Konstantin Komarov
Browse files

fs/ntfs3: Improved checking of attribute's name length



Added comment, added null pointer checking.

Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent fc499245
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -137,7 +137,13 @@ static struct inode *ntfs_read_mft(struct inode *inode,
	rsize = attr->non_res ? 0 : le32_to_cpu(attr->res.data_size);
	asize = le32_to_cpu(attr->size);

	if (le16_to_cpu(attr->name_off) + attr->name_len > asize)
	/*
	 * Really this check was done in 'ni_enum_attr_ex' -> ... 'mi_enum_attr'.
	 * There not critical to check this case again
	 */
	if (attr->name_len &&
	    sizeof(short) * attr->name_len + le16_to_cpu(attr->name_off) >
		    asize)
		goto out;

	if (attr->non_res) {