mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-23 14:24:14 -04:00
Merge 05c88a17e9
into 32148e7440
This commit is contained in:
commit
3b5ebff1ed
2 changed files with 5 additions and 1 deletions
|
@ -502,7 +502,7 @@ public class PersistenceManager<T extends PersistableEnvelope> {
|
|||
|
||||
tempFile = usedTempFilePath != null
|
||||
? FileUtil.createNewFile(usedTempFilePath)
|
||||
: File.createTempFile("temp_" + fileName, null, dir);
|
||||
: Files.createTempFile(dir.toPath(), "temp_" + fileName, null).toFile();
|
||||
// Don't use a new temp file path each time, as that causes the delete-on-exit hook to leak memory:
|
||||
tempFile.deleteOnExit();
|
||||
|
||||
|
|
|
@ -104,6 +104,10 @@ public class ZipUtils {
|
|||
int count;
|
||||
while ((entry = zipStream.getNextEntry()) != null) {
|
||||
File file = new File(dir, entry.getName());
|
||||
if (!file.toPath().normalize().startsWith(dir.toPath())) {
|
||||
throw new SecurityException("ZIP entry contains path traversal attempt: " + entry.getName());
|
||||
}
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
file.mkdirs();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue