Prevent handshake spam from invalid names.

This commit is contained in:
Benjamin James Harrison-Sims 2013-04-14 03:09:29 +01:00
parent 079dc61259
commit 4cc6854a67

View File

@ -0,0 +1,21 @@
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