diff options
author | Shoaib Meenai <smeenai@fb.com> | 2018-12-13 00:08:25 +0000 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2018-12-13 00:08:25 +0000 |
commit | 96929fdd428aafc9ed3d3a2070627fabb58db1b2 (patch) | |
tree | 6bb5cbf230cf29a65d4c38bb11ebccd63248fb63 /llvm/lib/Support/Windows/Path.inc | |
parent | 589f1764fc5dbe8cfdd35791ed970b7e0932d7d7 (diff) | |
download | bcm5719-llvm-96929fdd428aafc9ed3d3a2070627fabb58db1b2.tar.gz bcm5719-llvm-96929fdd428aafc9ed3d3a2070627fabb58db1b2.zip |
[Support] Fix FileNameLength passed to SetFileInformationByHandle
The rename_internal function used for Windows has a minor bug where the
filename length is passed as a character count instead of a byte count.
Windows internally ignores this field, but other tools that hook NT
api's may use the documented behavior:
MSDN documentation specifying the size should be in bytes:
https://docs.microsoft.com/en-us/windows/desktop/api/winbase/ns-winbase-_file_rename_info
Patch by Ben Hillis.
Differential Revision: https://reviews.llvm.org/D55624
llvm-svn: 348995
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r-- | llvm/lib/Support/Windows/Path.inc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc index 678c9a819d8..d34aa763124 100644 --- a/llvm/lib/Support/Windows/Path.inc +++ b/llvm/lib/Support/Windows/Path.inc @@ -416,7 +416,7 @@ static std::error_code rename_internal(HANDLE FromHandle, const Twine &To, *reinterpret_cast<FILE_RENAME_INFO *>(RenameInfoBuf.data()); RenameInfo.ReplaceIfExists = ReplaceIfExists; RenameInfo.RootDirectory = 0; - RenameInfo.FileNameLength = ToWide.size(); + RenameInfo.FileNameLength = ToWide.size() * sizeof(wchar_t); std::copy(ToWide.begin(), ToWide.end(), &RenameInfo.FileName[0]); SetLastError(ERROR_SUCCESS); |