Merge branch 'dev' into 'master'

FloorPlanEditor Exploit Fix

See merge request morningstar/Arcturus-Community!46
This commit is contained in:
Harmonic 2019-07-08 21:30:55 -04:00
commit f1aac8eaf3
4 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1 @@
INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.room.floorplan.check.enabled', '1');

View File

@ -37,7 +37,7 @@ public final class Emulator {
public final static int MINOR = 1;
public final static int BUILD = 0;
public final static int BUILD = 1;
public final static String PREVIEW = "Stable";
@ -143,6 +143,7 @@ public final class Emulator {
Emulator.getLogging().logStart("Thankyou for downloading Arcturus Morningstar! This is a stable 2.1.0 build, it should be more than stable for daily use on hotels, if you find any bugs please place them on our git repository.");
Emulator.getLogging().logStart("Please note, Arcturus Emulator is a project by TheGeneral, we take no credit for the original work, and only the work we have continued. If you'd like to support the project, join our discord at: ");
Emulator.getLogging().logStart("https://discord.gg/syuqgN");
Emulator.getLogging().logStart("Please report bugs on our git at Krews.org. Not on our discord!!");
System.out.println("Waiting for commands: ");
}
}, 3500);

View File

@ -20,6 +20,7 @@ import java.util.List;
public class FloorPlanEditorSaveEvent extends MessageHandler {
public static int MAXIMUM_FLOORPLAN_WIDTH_LENGTH = 64;
public static int MAXIMUM_FLOORPLAN_SIZE = 64 * 64;
public static final String VALID_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
@Override
public void handle() throws Exception {
@ -38,6 +39,18 @@ public class FloorPlanEditorSaveEvent extends MessageHandler {
String map = this.packet.readString();
map = map.replace("X", "x");
String checkMap = map.replace(((char) 13) + "", "").toUpperCase();
for (char c : VALID_CHARACTERS.toCharArray())
{
checkMap = checkMap.replace(c + "", "");
}
if (!checkMap.isEmpty() && Emulator.getConfig().getBoolean("hotel.room.floorplan.check.enabled"))
{
errors.add("${notification.floorplan_editor.error.title}");
}
if (map.isEmpty() || map.replace("x", "").replace(((char) 13) + "", "").length() == 0) {
errors.add("${notification.floorplan_editor.error.message.effective_height_is_0}");
}