Skip to content

Commit

Permalink
Merge pull request #138 from Bobini1/develop
Browse files Browse the repository at this point in the history
Fix buffer size decrementation for racy dir enumeration for issue #137
  • Loading branch information
ned14 authored Aug 13, 2024
2 parents a25485e + a63d6cf commit c032616
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/llfio/v2.0/detail/impl/windows/directory_handle.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,9 @@ result<directory_handle::buffers_type> directory_handle::read(io_request<buffers
if(done)
{
auto whattoadd = (7 + offsetof(what_to_enumerate_type, FileName) + ffdi->FileNameLength) & ~7;
buffer_ = reinterpret_cast<what_to_enumerate_type *>(reinterpret_cast<uintptr_t>(ffdi) + whattoadd);
bytes -= whattoadd;
auto new_buffer_start = reinterpret_cast<what_to_enumerate_type *>(reinterpret_cast<uintptr_t>(ffdi) + whattoadd);
bytes -= reinterpret_cast<uintptr_t>(new_buffer_start) - reinterpret_cast<uintptr_t>(buffer_);
buffer_ = new_buffer_start;
}
}
}
Expand Down

0 comments on commit c032616

Please sign in to comment.