我使用zip4j库将文件解压缩到内部应用程序文件夹(即getApplicationInfo().dataDir + "/databases"
),并且该应用程序已发布在Play商店中,控制台发出警告“修复Zip路径遍历漏洞Android“
https://support.google.com/faqs/answer/9294009
如何解决此问题或任何其他用于解压缩受密码保护的zip文件的库。谢谢
这里是用于提取受密码保护的zip文件的代码。
try {
net.lingala.zip4j.core.ZipFile zipFile = new net.lingala.zip4j.core.ZipFile(zipFilePath);
if (zipFile.isEncrypted())
zipFile.setPassword(pass.toCharArray());
File des = new File(unzipAtLocation);
boolean isCreated = true;
if (!des.exists())
isCreated = des.mkdirs();
if (isCreated)
zipFile.extractAll(unzipAtLocation);
} catch (Exception e) {
Log.e("Unzip zip", "Unzip exception", e);
}
此问题已在Zip4j的版本2.3.1
中修复。