From a63d6cfe95ad2cbb097e4eead04c6d825f71c5f5 Mon Sep 17 00:00:00 2001 From: Tomasz Kalisiak Date: Wed, 31 Jul 2024 05:27:28 +0200 Subject: [PATCH] Fix buffer size decrementation for racy dir enumeration for issue #137 --- include/llfio/v2.0/detail/impl/windows/directory_handle.ipp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/llfio/v2.0/detail/impl/windows/directory_handle.ipp b/include/llfio/v2.0/detail/impl/windows/directory_handle.ipp index 7c21aac8..d07b657e 100644 --- a/include/llfio/v2.0/detail/impl/windows/directory_handle.ipp +++ b/include/llfio/v2.0/detail/impl/windows/directory_handle.ipp @@ -501,8 +501,9 @@ result directory_handle::read(io_requestFileNameLength) & ~7; - buffer_ = reinterpret_cast(reinterpret_cast(ffdi) + whattoadd); - bytes -= whattoadd; + auto new_buffer_start = reinterpret_cast(reinterpret_cast(ffdi) + whattoadd); + bytes -= reinterpret_cast(new_buffer_start) - reinterpret_cast(buffer_); + buffer_ = new_buffer_start; } } }