File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments