forked from I2P_Developers/i2p.i2p
Profiles: length check on file names
This commit is contained in:
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 0;
|
||||
public final static long BUILD = 1;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
@ -44,6 +44,7 @@ class ProfilePersistenceHelper {
|
||||
private static final String SUFFIX = ".txt.gz";
|
||||
private static final String UNCOMPRESSED_SUFFIX = ".txt";
|
||||
private static final String OLD_SUFFIX = ".dat";
|
||||
private static final int MIN_NAME_LENGTH = PREFIX.length() + 44 + OLD_SUFFIX.length();
|
||||
private static final String DIR_PREFIX = "p";
|
||||
private static final String B64 = Base64.ALPHABET_I2P;
|
||||
|
||||
@ -193,6 +194,7 @@ class ProfilePersistenceHelper {
|
||||
private static class ProfileFilter implements FilenameFilter {
|
||||
public boolean accept(File dir, String filename) {
|
||||
return (filename.startsWith(PREFIX) &&
|
||||
filename.length() >= MIN_NAME_LENGTH &&
|
||||
(filename.endsWith(SUFFIX) || filename.endsWith(OLD_SUFFIX) || filename.endsWith(UNCOMPRESSED_SUFFIX)));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user