From 53070f8bb58e04f28d7e26ff7ddbac9307d01c96 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Fri, 26 Jun 2020 01:11:55 +0200 Subject: Linux/MacOSX: fix warning reported by static code analysis tool about possible undefined output value in UserPreferences::SetValue and missing initialization of member variables in File constructor --- src/Main/UserPreferences.cpp | 4 ++-- src/Platform/File.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Main/UserPreferences.cpp b/src/Main/UserPreferences.cpp index e4cc4943..db54b4a4 100644 --- a/src/Main/UserPreferences.cpp +++ b/src/Main/UserPreferences.cpp @@ -21,7 +21,7 @@ namespace VeraCrypt { if (cfgText == L"0") cfgVar = false; - else if (cfgText == L"1") + else cfgVar = true; } @@ -93,7 +93,7 @@ namespace VeraCrypt TC_CONFIG_SET (MountDevicesOnLogon); TC_CONFIG_SET (MountFavoritesOnLogon); - bool readOnly; + bool readOnly = false; SetValue (configMap[L"MountVolumesReadOnly"], readOnly); DefaultMountOptions.Protection = readOnly ? VolumeProtection::ReadOnly : VolumeProtection::None; diff --git a/src/Platform/File.h b/src/Platform/File.h index 09924b29..a8befe38 100644 --- a/src/Platform/File.h +++ b/src/Platform/File.h @@ -54,7 +54,11 @@ namespace VeraCrypt typedef int SystemFileHandleType; #endif - File () : FileIsOpen (false), SharedHandle (false) { } + File () : FileIsOpen (false), mFileOpenFlags (FlagsNone), SharedHandle (false), FileHandle (0) +#ifndef TC_WINDOWS + ,AccTime(0), ModTime (0) +#endif + { } virtual ~File (); void AssignSystemHandle (SystemFileHandleType openFileHandle, bool sharedHandle = true) -- cgit v1.2.3