Fix swf exploit

This commit is contained in:
Remco 2020-11-18 13:00:41 +01:00
parent 6b73e4b51c
commit dd1ba30a46

View File

@ -7,11 +7,15 @@ import java.io.OutputStream;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Arrays;
public class FTPUploadService { public class FTPUploadService {
private static final String ftpUrl = "ftp://%s:%s@%s/%s;type=i"; private static final String ftpUrl = "ftp://%s:%s@%s/%s;type=i";
public static void uploadImage(byte[] image, String uploadPath) throws IOException{ public static void uploadImage(byte[] image, String uploadPath) throws IOException{
byte[] pngSignature = new byte[] { -119, 80, 78, 71, 13, 10, 26, 10 };
if (Arrays.equals(Arrays.copyOfRange(image, 0, 8), pngSignature)) {
String host = Emulator.getConfig().getValue("ftp.host"); String host = Emulator.getConfig().getValue("ftp.host");
String user = Emulator.getConfig().getValue("ftp.user"); String user = Emulator.getConfig().getValue("ftp.user");
String pass = Emulator.getConfig().getValue("ftp.password"); String pass = Emulator.getConfig().getValue("ftp.password");
@ -25,3 +29,4 @@ public class FTPUploadService {
outputStream.close(); outputStream.close();
} }
} }
}