VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Setup
diff options
context:
space:
mode:
Diffstat (limited to 'src/Setup')
-rw-r--r--src/Setup/Dir.c12
-rw-r--r--src/Setup/Setup.c3
2 files changed, 14 insertions, 1 deletions
diff --git a/src/Setup/Dir.c b/src/Setup/Dir.c
index 2d4feecd..3275567f 100644
--- a/src/Setup/Dir.c
+++ b/src/Setup/Dir.c
@@ -33,2 +33,8 @@ mkfulldir (wchar_t *oriPath, BOOL bCheckonly)
+ 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);
@@ -68,2 +74,8 @@ mkfulldir_internal (wchar_t *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);
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index 9433bd40..43c951f5 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -821,3 +821,4 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
- GetSystemDirectory (szDir, ARRAYSIZE (szDir));
+ if (!GetSystemDirectory (szDir, ARRAYSIZE (szDir)))
+ StringCbCopyW(szDir, sizeof(szDir), L"C:\\Windows\\System32");