From a7c6d5e987ca4bf9c910eec9f2b86c37dbaf446a Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 17 Oct 2018 23:57:36 +1100 Subject: [PATCH] schem list validation --- .../java/com/sk89q/worldedit/command/SchematicCommands.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index 57de81adb..d7686aa8c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -603,6 +603,11 @@ public class SchematicCommands extends MethodCommands { if (uriStr.startsWith("file:/")) { File file = new File(uri.getPath()); name = file.getName(); + try { + if (!MainUtil.isInSubDirectory(dir, file)) { + throw new RuntimeException(new CommandException("Invalid path")); + } + } catch (IOException ignore) {} if (file.isDirectory()) { isDir = true; color = "&6";