Skip to content

Commit

Permalink
change path validation for service installs when install location con…
Browse files Browse the repository at this point in the history
…tains system32
  • Loading branch information
eyedeekay committed Sep 13, 2022
1 parent 2fd01c8 commit 0ce816a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions router/java/src/net/i2p/router/startup/WorkingDir.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,19 @@ public static String getWorkingDir(Properties envProps, boolean migrateOldConfig
}
}
String programData = System.getenv("PROGRAMDATA");
if (home.toLowerCase().contains(programData.toLowerCase()) || home.toLowerCase().contains("system32".toLowerCase())) {
home = programData;
String winDirSystem32 = System.getenv("WINDIR");
if (winDirSystem32 != null) {
winDirSystem32 = new File(winDirSystem32, "system32").getAbsolutePath();
}
if (winDirSystem32 != null) {
if (home.toLowerCase().startsWith(winDirSystem32.toLowerCase())) {
home = programData;
}
}
if (programData != null) {
if (home.toLowerCase().startsWith(programData.toLowerCase())) {
home = programData;
}
}
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_WINDOWS);
} else if (SystemVersion.isMac()) {
Expand Down

0 comments on commit 0ce816a

Please sign in to comment.