File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
include/fast_io_hosted/platforms/nt Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -105,20 +105,25 @@ inline auto nt_call_invoke_with_directory_handle_impl(void *directory, char_type
105105
106106 auto const char16_t_size{bytes / sizeof (char16_t )};
107107
108- rtl_alloc_guard rtl_guard{rtl_alloc_guard::allocator::allocate (char16_t_size)};
108+ rtl_alloc_guard rtl_guard{rtl_alloc_guard::allocator::allocate (char16_t_size + 1u )};
109109
110110 ::fast_io::freestanding::nonoverlapped_bytes_copy_n (reinterpret_cast <::std::byte const *>(filename), bytes, reinterpret_cast<::std::byte *>(rtl_guard.ptr));
111111
112- for (auto curr{rtl_guard.ptr }; curr != rtl_guard.ptr + char16_t_size; ++curr)
112+ auto curr{rtl_guard.ptr };
113+ for (; curr != rtl_guard.ptr + char16_t_size; ++curr)
113114 {
114115 if (*curr == u' /' )
115116 {
116117 *curr = u' \\ ' ;
117118 }
118119 }
119120
121+ *curr = u' \0 ' ;
122+
120123 win32::nt::unicode_string relative_path{
121- .Length = bytes, .MaximumLength = bytes, .Buffer = rtl_guard.ptr };
124+ .Length = bytes,
125+ .MaximumLength = static_cast <::std::uint_least16_t >(bytes + sizeof (char16_t )),
126+ .Buffer = rtl_guard.ptr };
122127 return callback (directory, __builtin_addressof (relative_path));
123128 }
124129 else if constexpr (sizeof (char_type) == sizeof (char16_t ))
You can’t perform that action at this time.
0 commit comments