Profiles: length check on file names

This commit is contained in:
zzz
2016-12-16 18:06:38 +00:00
parent 14a839ebba
commit ce47d4ea68
3 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,28 @@
2016-12-16 zzz
* Router: Synchronize graceful exit code access
* Update: Save blocklist version in UpdateManager
2016-12-16 zzz
Prop from i2p.i2p.zzz.test2:
* BOB:
- Refactor NamedDB implementation to HashMap
- Refactor NamedDB locks to ReentrantReadWriteLock
- All unlocks in finally blocks, remove redundant unlocking
- Remove throw declaration from methods that don't
- Read under write lock when that's simpler
- Use Boolean fields rather than valueOf()
- Fix unlock order inversion in I2PtoTCP and MUXlisten
- Remove unused locking in TCPtoI2P
- Add missing locking in status command
- Remove redundant locking
- Remove unnecessary catch-and-rethrows
- Spelling fix in error message
- Make some methods static
* Console: Sort banlist and floodfills in true binary order, not by base64 string
* Utils:
- Consolidate stream copy code
- Consolidate base64 alphabet string
* 2016-12-12 0.9.28 released
2016-12-09 zzz

View File

@ -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 = "";

View File

@ -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)));
}
}