mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Windows: Add various checks to address Coverity reported issues.
This commit is contained in:
@@ -31,6 +31,12 @@ mkfulldir (wchar_t *oriPath, BOOL bCheckonly)
|
||||
wchar_t *uniq_file;
|
||||
wchar_t path [TC_MAX_PATH];
|
||||
|
||||
if (wcslen(oriPath) >= TC_MAX_PATH)
|
||||
{
|
||||
// directory name will be truncated so return failure to avoid unexepected behavior
|
||||
return -1;
|
||||
}
|
||||
|
||||
StringCbCopyW (path, TC_MAX_PATH, oriPath);
|
||||
|
||||
if (wcslen (path) == 3 && path[1] == L':')
|
||||
@@ -66,6 +72,12 @@ mkfulldir_internal (wchar_t *path)
|
||||
static wchar_t tokpath[_MAX_PATH];
|
||||
static wchar_t trail[_MAX_PATH];
|
||||
|
||||
if (wcslen(path) >= _MAX_PATH)
|
||||
{
|
||||
// directory name will be truncated so return failure to avoid unexepected behavior
|
||||
return -1;
|
||||
}
|
||||
|
||||
StringCbCopyW (tokpath, _MAX_PATH, path);
|
||||
trail[0] = L'\0';
|
||||
|
||||
|
||||
@@ -819,7 +819,8 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
|
||||
if (Is64BitOs ())
|
||||
driver64 = TRUE;
|
||||
|
||||
GetSystemDirectory (szDir, ARRAYSIZE (szDir));
|
||||
if (!GetSystemDirectory (szDir, ARRAYSIZE (szDir)))
|
||||
StringCbCopyW(szDir, sizeof(szDir), L"C:\\Windows\\System32");
|
||||
|
||||
x = wcslen (szDir);
|
||||
if (szDir[x - 1] != L'\\')
|
||||
|
||||
Reference in New Issue
Block a user