From 3f8ecf497b1ef0d88d735d67f05b56651e5a73e9 Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Fri, 11 Apr 2014 13:08:04 +0100 Subject: [PATCH] Validate skins server side to try catch some out of date plugins --- .../0128-1.7.6-pre1-support.patch | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/CraftBukkit-Patches/0128-1.7.6-pre1-support.patch b/CraftBukkit-Patches/0128-1.7.6-pre1-support.patch index a9a0092745..07c3bdc83a 100644 --- a/CraftBukkit-Patches/0128-1.7.6-pre1-support.patch +++ b/CraftBukkit-Patches/0128-1.7.6-pre1-support.patch @@ -1,4 +1,4 @@ -From 53269d6cfc3f178e66c9bb1ecbaca96341e700d2 Mon Sep 17 00:00:00 2001 +From eb1f5710238f46dedec083d03215a0d48d4f946c Mon Sep 17 00:00:00 2001 From: Thinkofdeath Date: Thu, 3 Apr 2014 17:04:18 +0100 Subject: [PATCH] 1.7.6-pre1 support @@ -264,7 +264,7 @@ index 0000000..3aa93cd + } +} diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java -index 8bab528..0884047 100644 +index 8bab528..5483641 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java @@ -2,6 +2,7 @@ package net.minecraft.server; @@ -275,7 +275,37 @@ index 8bab528..0884047 100644 import net.minecraft.util.com.mojang.authlib.GameProfile; import java.io.IOException; // CraftBukkit -@@ -60,6 +61,41 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { +@@ -33,7 +34,29 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { + + this.h = itemstack == null ? 0 : Item.b(itemstack.getItem()); + this.i = entityhuman.getDataWatcher(); ++ ++ // Spigot start - Validate Profile ++ validate(); ++ } ++ ++ private void validate() ++ { ++ if ( MinecraftServer.getServer().getOnlineMode() ) ++ { ++ if ( this.b instanceof ThreadPlayerLookupUUID.NewGameProfileWrapper ) ++ { ++ org.spigotmc.authlib.GameProfile newProfile = ( (ThreadPlayerLookupUUID.NewGameProfileWrapper) this.b ).newProfile; ++ if ( MinecraftServer.getServer().newSessionService.getTextures( newProfile, true ).size() == 0 ) ++ { ++ throw new IllegalArgumentException( "PacketPlayOutNamedEntitySpawn requires a valid profile in online mode" ); ++ } ++ } else ++ { ++ throw new IllegalArgumentException( "PacketPlayOutNamedEntitySpawn requires a valid profile in online mode" ); ++ } ++ } + } ++ // Spigot end + + public void a(PacketDataSerializer packetdataserializer) throws IOException { // CraftBukkit - added throws + this.a = packetdataserializer.a(); +@@ -60,6 +83,42 @@ public class PacketPlayOutNamedEntitySpawn extends Packet { this.i.a(packetdataserializer); } @@ -283,6 +313,7 @@ index 8bab528..0884047 100644 + @Override + public void writeSnapshot(PacketDataSerializer packetdataserializer) throws IOException + { // CraftBukkit - added throws ++ validate(); + packetdataserializer.b( this.a ); + packetdataserializer.a( EntityHuman.a( this.b ).toString() ); + packetdataserializer.a( this.b.getName().length() > 16 ? this.b.getName().substring( 0, 16 ) : this.b.getName() ); // CraftBukkit - Limit name length to 16 characters