mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-27 07:05:39 +00:00
29 lines
1.5 KiB
Diff
29 lines
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Telesphoreo <me@telesphoreo.me>
|
|
Date: Fri, 14 Jun 2024 18:00:35 -0500
|
|
Subject: [PATCH] Prevent attributes with invalid namespaces from being applied
|
|
to CraftMetaItems
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
index b6cd6897844aa9c8b9a94e41c56c4cfe4ac78780..34130c2cc3f643fcfe32a02747c45dd1eba05396 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
@@ -57,6 +57,7 @@ import net.minecraft.nbt.NbtOps;
|
|
import net.minecraft.nbt.SnbtPrinterTagVisitor;
|
|
import net.minecraft.nbt.Tag;
|
|
import net.minecraft.network.chat.Component;
|
|
+import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.util.Unit;
|
|
import net.minecraft.world.entity.EquipmentSlotGroup;
|
|
@@ -764,7 +765,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
continue;
|
|
}
|
|
String attributeName = (String) obj;
|
|
- if (Strings.isNullOrEmpty(attributeName)) {
|
|
+ if (Strings.isNullOrEmpty(attributeName) || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
|
continue;
|
|
}
|
|
List<?> list = SerializableMeta.getObject(List.class, mods, attributeName, true);
|