Fix range checking error spotted by Szaka.

(Logical change 1.265)
edge.strict_endians
cantab.net!aia21 2004-01-19 09:09:56 +00:00
parent 4ef67c7247
commit 205a5db037
1 changed files with 9 additions and 6 deletions

View File

@ -2096,12 +2096,15 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type,
if (!ad)
return -1;
/* We found the attribute. - Do the bounds check. */
if (size >= sle64_to_cpu(ad->min_size) &&
size <= sle64_to_cpu(ad->max_size))
return 0;
/* @size is out of range! */
errno = ERANGE;
return -1;
if ((sle64_to_cpu(ad->min_size) && size <
sle64_to_cpu(ad->min_size)) ||
(sle64_to_cpu(ad->max_size) && size >
sle64_to_cpu(ad->max_size))) {
/* @size is out of range! */
errno = ERANGE;
return -1;
}
return 0;
}
/**