Paper/CraftBukkit-Patches/0106-Cap-Objective-Score-Length.patch
2016-03-03 03:46:56 -06:00

23 lines
1.0 KiB
Diff

From f43b9f8ca15034bc6c64d21d2060c77ae85d35cc Mon Sep 17 00:00:00 2001
From: hauno <imhauno@gmail.com>
Date: Tue, 6 May 2014 18:01:37 -0700
Subject: [PATCH] Cap Objective Score Length
Adds a check for Score arguments that would crash the client
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
index 239ceca..5bd8cf9 100644
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java
@@ -93,6 +93,7 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective
public Score getScore(String entry) throws IllegalArgumentException, IllegalStateException {
Validate.notNull(entry, "Entry cannot be null");
+ if (entry.length() > 40) throw new IllegalArgumentException("Entry cannot be longer than 40 characters!"); // Spigot
CraftScoreboard scoreboard = checkState();
return new CraftScore(this, entry);
--
2.5.0