Secured write position to compressed files

N2009_11_14_FIXES
jpandre 2009-04-25 12:02:20 +00:00
parent 54f745e3f3
commit c87fc027df
1 changed files with 4 additions and 2 deletions

View File

@ -1502,7 +1502,8 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
goto err_out;
}
if (compressed) {
while (ofs >= (rl->length << vol->cluster_size_bits)) {
while (rl->length
&& (ofs >= (rl->length << vol->cluster_size_bits))) {
ofs -= rl->length << vol->cluster_size_bits;
rl++;
}
@ -1778,7 +1779,8 @@ int ntfs_attr_pclose(ntfs_attr *na)
if (ntfs_attr_fill_hole(na, (s64)0, &ofs, &rl, &update_from))
goto err_out;
}
while (ofs >= (rl->length << vol->cluster_size_bits)) {
while (rl->length
&& (ofs >= (rl->length << vol->cluster_size_bits))) {
ofs -= rl->length << vol->cluster_size_bits;
rl++;
}