`current_working_directory` may read out of bounds and uninitialized memory with long paths
BurningEnlightenment opened this issue · 3 comments
llfio/include/llfio/v2.0/detail/impl/windows/path_discovery.ipp
Lines 162 to 168 in ee65f1b
GetCurrentDirectory
returns the required buffer size if the path doesn't fit into the given buffer (see Windows docs). In case of a long path aware application this can lead to passing the uninitialized buffer
with an out of bounds size to the fs_handle
constructor.
@ned14 given that we generally don't allocate heap memory, we would either need to increase the buffer size to 2^15 or check written > MAX_PATH
and return an error code, right?
Sorry, forgot about this one with the Varna meeting. And I'm heading to New York tomorrow for a few days for the new job.
Stack is cheap on Windows, so I'd just bump that buffer to 32769 like most other parts of LLFIO.
Fixed by fed9ca7