Commit 922e1e6a authored by 陈精华's avatar 陈精华

修复压缩文件目录穿越漏洞

parent 79341b2c
......@@ -55,7 +55,7 @@ public class CompressFileReader {
List<Map<String, ZipArchiveEntry>> entriesToBeExtracted = new LinkedList<>();
while (entries.hasMoreElements()) {
ZipArchiveEntry entry = entries.nextElement();
String fullName = entry.getName();
String fullName = entry.getName().replaceAll("//", "").replaceAll("\\\\", "");
int level = fullName.split(archiveSeparator).length;
// 展示名
String originName = getLastFileName(fullName, archiveSeparator);
......@@ -151,7 +151,7 @@ public class CompressFileReader {
List<Map<String, SevenZArchiveEntry>> entriesToBeExtracted = new ArrayList<>();
while (newEntries.hasMoreElements()) {
SevenZArchiveEntry entry = newEntries.nextElement();
String fullName = entry.getName();
String fullName = entry.getName().replaceAll("//", "").replaceAll("\\\\", "");
int level = fullName.split(archiveSeparator).length;
// 展示名
String originName = getLastFileName(fullName, archiveSeparator);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment