add check for apk warning

This commit is contained in:
afischerdev 2023-05-04 10:39:53 +02:00
parent 2c707c977b
commit cdda6ee32c
2 changed files with 9 additions and 2 deletions

View file

@ -562,7 +562,10 @@ public class BRouterView extends View {
}
String name = ze.getName();
File outfile = new File(path, name);
if (!outfile.exists() && outfile.getParentFile() != null) {
String canonicalPath = outfile.getCanonicalPath();
if (canonicalPath.startsWith(path.getCanonicalPath()) &&
!outfile.exists() &&
outfile.getParentFile() != null) {
outfile.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream(outfile);
@ -575,6 +578,7 @@ public class BRouterView extends View {
fos.close();
}
}
zis.close();
is.close();
return true;
} catch (IOException io) {

View file

@ -105,7 +105,10 @@ public class ServerConfig {
String name = ze.getName();
if (name.equals(mServerConfigName)) {
File outfile = new File(path, name + ".tmp");
if (!outfile.exists() && outfile.getParentFile() != null) {
String canonicalPath = outfile.getCanonicalPath();
if (canonicalPath.startsWith(path.getCanonicalPath()) &&
!outfile.exists() &&
outfile.getParentFile() != null) {
outfile.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream(outfile);