diff options
Diffstat (limited to 'src/Platform')
-rw-r--r-- | src/Platform/Unix/FilesystemPath.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Platform/Unix/FilesystemPath.cpp b/src/Platform/Unix/FilesystemPath.cpp index 5841edf4..d6c9cd2b 100644 --- a/src/Platform/Unix/FilesystemPath.cpp +++ b/src/Platform/Unix/FilesystemPath.cpp @@ -83,10 +83,10 @@ namespace VeraCrypt string linkPathName ("/sys/dev/block/"); linkPathName += StringConverter::ToSingle (major (st.st_rdev)) + string (":") + StringConverter::ToSingle (minor (st.st_rdev)); - char linkTargetPath[maxPathLength+1] = ""; + vector<char> linkTargetPath(maxPathLength+1); - if(readlink(linkPathName.c_str (), linkTargetPath, sizeof (linkTargetPath)) != -1) { - const string targetPathStr (linkTargetPath); + if(readlink(linkPathName.c_str (), linkTargetPath.data(), linkTargetPath.size()) != -1) { + const string targetPathStr (linkTargetPath.data()); const size_t lastSlashPos = targetPathStr.find_last_of ('/'); const size_t secondLastSlashPos = targetPathStr.find_last_of ('/', lastSlashPos-1); path = string ("/dev/") + targetPathStr.substr (secondLastSlashPos+1, lastSlashPos-secondLastSlashPos-1); |