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) if (!ad)
return -1; return -1;
/* We found the attribute. - Do the bounds check. */ /* We found the attribute. - Do the bounds check. */
if (size >= sle64_to_cpu(ad->min_size) && if ((sle64_to_cpu(ad->min_size) && size <
size <= sle64_to_cpu(ad->max_size)) sle64_to_cpu(ad->min_size)) ||
return 0; (sle64_to_cpu(ad->max_size) && size >
/* @size is out of range! */ sle64_to_cpu(ad->max_size))) {
errno = ERANGE; /* @size is out of range! */
return -1; errno = ERANGE;
return -1;
}
return 0;
} }
/** /**