Skip to content

Commit

Permalink
Increase handshake length limit to 2500
Browse files Browse the repository at this point in the history
  • Loading branch information
lucko committed Apr 19, 2021
1 parent 5569398 commit 73abb49
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class BungeeCordHandshake {
private static final String PROPERTY_NAME_KEY = "name";
/** The key used to define the value of properties in the handshake. */
private static final String PROPERTY_VALUE_KEY = "value";
/** The maximum allowed length of the handshake. */
private static final int HANDSHAKE_LENGTH_LIMIT = 2500;

/** Shared Gson instance. */
private static final Gson GSON = new Gson();
Expand All @@ -72,8 +74,8 @@ public static BungeeCordHandshake decodeAndVerify(String handshake, TokenStore t
}

private static BungeeCordHandshake decodeAndVerify0(String handshake, TokenStore tokenStore) throws Exception {
if (handshake.length() > 1000) {
return new Fail(Fail.Reason.INVALID_HANDSHAKE, "handshake exceeds 1000 characters");
if (handshake.length() > HANDSHAKE_LENGTH_LIMIT) {
return new Fail(Fail.Reason.INVALID_HANDSHAKE, "handshake length " + handshake.length() + " is > " + HANDSHAKE_LENGTH_LIMIT);
}

String[] split = handshake.split("\00");
Expand Down

0 comments on commit 73abb49

Please sign in to comment.