testserver/CraftBukkit-Patches/0039-Prevent-handshake-spam...

22 lines
948 B
Diff
Raw Normal View History

From f22c9b13df956663f41d000bea443a737624b91c Mon Sep 17 00:00:00 2001
From: Benjamin James Harrison-Sims <tehrainbowguy@gmail.com>
Date: Sun, 14 Apr 2013 03:08:51 +0100
Subject: [PATCH] Prevent handshake spam from invalid names.
diff --git a/src/main/java/net/minecraft/server/Packet2Handshake.java b/src/main/java/net/minecraft/server/Packet2Handshake.java
index 343af93..920e045 100644
--- a/src/main/java/net/minecraft/server/Packet2Handshake.java
+++ b/src/main/java/net/minecraft/server/Packet2Handshake.java
@@ -19,6 +19,7 @@ public class Packet2Handshake extends Packet {
this.b = a(datainputstream, 16);
this.c = a(datainputstream, 255);
this.d = datainputstream.readInt();
+ if(!this.b.matches("^[a-zA-Z0-9_]{3,16}$")){throw new IOException("Invalid name!");}// Spigot
}
public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
--
1.8.2.1