mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merge pull request #306 from AtlasMediaGroup/critical-exploit-fix
Patches critical exploit in the command blocker
This commit is contained in:
commit
72c83ba84a
@ -24,7 +24,7 @@ import org.bukkit.plugin.SimplePluginManager;
|
|||||||
|
|
||||||
public class CommandBlocker extends FreedomService
|
public class CommandBlocker extends FreedomService
|
||||||
{
|
{
|
||||||
|
private final Pattern whitespacePattern = Pattern.compile("^/?( +)(.*)?");
|
||||||
private final Pattern flagPattern = Pattern.compile("(:([0-9]){5,})");
|
private final Pattern flagPattern = Pattern.compile("(:([0-9]){5,})");
|
||||||
//
|
//
|
||||||
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
||||||
@ -156,6 +156,14 @@ public class CommandBlocker extends FreedomService
|
|||||||
|
|
||||||
// Format
|
// Format
|
||||||
command = command.toLowerCase().trim();
|
command = command.toLowerCase().trim();
|
||||||
|
|
||||||
|
// Whitespaces
|
||||||
|
Matcher whitespaceMatcher = whitespacePattern.matcher(command);
|
||||||
|
if (whitespaceMatcher.matches() && whitespaceMatcher.groupCount() == 2)
|
||||||
|
{
|
||||||
|
command = whitespaceMatcher.group(2);
|
||||||
|
}
|
||||||
|
|
||||||
command = command.startsWith("/") ? command.substring(1) : command;
|
command = command.startsWith("/") ? command.substring(1) : command;
|
||||||
|
|
||||||
// Check for plugin specific commands
|
// Check for plugin specific commands
|
||||||
|
Loading…
Reference in New Issue
Block a user