diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp index 1fb26a9a..215b1f86 100644 --- a/src/Common/BootEncryption.cpp +++ b/src/Common/BootEncryption.cpp @@ -1041,7 +1041,7 @@ namespace VeraCrypt FileOpen = false; Elevated = false; - if (path.find(L"\\\\?\\") == 0) + if (path.find(L"\\\\?\\") == 0 || path.find(L"\\\\.\\") == 0) effectivePath = path; else effectivePath = wstring (L"\\\\.\\") + path; diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp index 738116b0..a78c96fb 100644 --- a/src/Format/FormatCom.cpp +++ b/src/Format/FormatCom.cpp @@ -92,6 +92,8 @@ public: virtual BOOL STDMETHODCALLTYPE FormatNtfs (int driveNo, int clusterSize) { + if (driveNo < 0 || driveNo > 25) + return ERROR_INVALID_PARAMETER; return ::FormatNtfs (driveNo, clusterSize, TRUE); } @@ -134,6 +136,8 @@ public: virtual BOOL STDMETHODCALLTYPE FormatFs (int driveNo, int clusterSize, int fsType) { + if (driveNo < 0 || driveNo > 25) + return ERROR_INVALID_PARAMETER; return ::FormatFs (driveNo, clusterSize, fsType, TRUE); }