2013-07-02 05:21:57 +02:00
|
|
|
From a28b8f77048de159f9d0c47dadc57a2138b06f3f Mon Sep 17 00:00:00 2001
|
2013-06-20 11:44:06 +02:00
|
|
|
From: Benjamin James Harrison-Sims <tehrainbowguy@gmail.com>
|
|
|
|
Date: Sun, 14 Apr 2013 21:19:57 +0500
|
2013-06-21 09:45:10 +02:00
|
|
|
Subject: [PATCH] Filter Invalid Names
|
2013-06-20 11:44:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Packet2Handshake.java b/src/main/java/net/minecraft/server/Packet2Handshake.java
|
2013-07-02 05:03:56 +02:00
|
|
|
index 1e7bad0..f25afb6 100644
|
2013-06-20 11:44:06 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Packet2Handshake.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Packet2Handshake.java
|
2013-07-02 05:03:56 +02:00
|
|
|
@@ -14,11 +14,14 @@ public class Packet2Handshake extends Packet {
|
2013-06-20 11:44:06 +02:00
|
|
|
|
|
|
|
public Packet2Handshake() {}
|
|
|
|
|
|
|
|
+ public static final java.util.regex.Pattern validName = java.util.regex.Pattern.compile("^[a-zA-Z0-9_-]{2,16}$");
|
2013-07-02 05:03:56 +02:00
|
|
|
public void a(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
|
|
|
|
this.a = datainput.readByte();
|
|
|
|
this.b = a(datainput, 16);
|
|
|
|
this.c = a(datainput, 255);
|
|
|
|
this.d = datainput.readInt();
|
|
|
|
+ // Spigot: TODO: md_5 hates this
|
2013-06-20 11:44:06 +02:00
|
|
|
+ if(!validName.matcher(this.b).matches()) throw new IOException("Invalid name!"); // Spigot
|
|
|
|
}
|
|
|
|
|
2013-07-02 05:03:56 +02:00
|
|
|
public void a(DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
|
2013-06-20 11:44:06 +02:00
|
|
|
--
|
|
|
|
1.8.1.2
|
|
|
|
|