Skip to content

Commit 87a5024

Browse files
committed
Linux: Allow AppImage file to start with "veracrypt" in any case
1 parent 69852fa commit 87a5024

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/Platform/Unix/Process.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,23 @@ namespace VeraCrypt
280280
if (appImageEnv && appDirEnv)
281281
{
282282
string appDirString = appDirEnv;
283-
string appImageFileString = appImageEnv;
284-
const string appImageMountPrefix1 = "/tmp/.mount_Veracr";
285-
const string appImageMountPrefix2 = "/tmp/.mount_VeraCr";
283+
const std::string appImageMountPrefix = "/tmp/.mount_";
284+
const std::string appImageMountSuffixPattern = "veracr"; // Lowercase for case-insensitive comparison
286285

287286
if (!appDirString.empty() &&
288287
executablePath.rfind(appDirString, 0) == 0 &&
289-
(appDirString.rfind(appImageMountPrefix1, 0) == 0 || appDirString.rfind(appImageMountPrefix2, 0) == 0))
288+
appDirString.rfind(appImageMountPrefix, 0) == 0)
290289
{
291-
// All conditions met, this is the AppImage scenario.
292-
return true;
290+
// Ensure appDirString has enough room for appImageMountPrefix and appImageMountSuffixPattern
291+
if (appDirString.length() > appImageMountPrefix.length() + appImageMountSuffixPattern.length())
292+
{
293+
std::string actualSuffixPart = appDirString.substr(appImageMountPrefix.length(), appImageMountSuffixPattern.length());
294+
if (StringConverter::ToLower(actualSuffixPart) == appImageMountSuffixPattern)
295+
{
296+
// All conditions met, this is the AppImage scenario.
297+
return true;
298+
}
299+
}
293300
}
294301
}
295302
return false;

0 commit comments

Comments
 (0)