Scissors/patches/server/0005-Fixes-the-Blank-SkullOwner-exploit.patch

28 lines
1.7 KiB
Diff
Raw Normal View History

2022-07-28 03:57:50 +00:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sun, 13 Mar 2022 03:01:29 -0600
2022-07-28 03:57:50 +00:00
Subject: [PATCH] Fixes the Blank SkullOwner exploit
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
2023-07-14 21:11:25 +00:00
index 47c8148e6413c51ffdd30082bfb37a7fb8a73a71..48fce864be2a92c9665b9eeb85e3193eaed4133d 100644
2022-07-28 03:57:50 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag;
2022-07-28 03:57:50 +00:00
import net.minecraft.nbt.NbtUtils;
2022-12-27 01:58:16 +00:00
import net.minecraft.resources.ResourceLocation;
2022-07-28 03:57:50 +00:00
import net.minecraft.world.level.block.entity.SkullBlockEntity;
+import org.apache.commons.lang3.StringUtils; // Scissors
2022-07-28 03:57:50 +00:00
import org.bukkit.Bukkit;
import org.bukkit.Material;
2022-12-27 01:58:16 +00:00
import org.bukkit.NamespacedKey;
2023-07-14 21:11:25 +00:00
@@ -74,7 +75,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
try { // Paper - Ignore invalid game profiles
2022-07-28 03:57:50 +00:00
if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
this.setProfile(NbtUtils.readGameProfile(tag.getCompound(SKULL_OWNER.NBT)));
- } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !tag.getString(SKULL_OWNER.NBT).isEmpty()) {
+ } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !StringUtils.isBlank(tag.getString(SKULL_OWNER.NBT))) { // Scissors
2022-07-28 03:57:50 +00:00
this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT)));
}
2023-07-14 21:11:25 +00:00
} catch (Exception ignored) {} // Paper