mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-01 04:37:09 +00:00
29 lines
1.6 KiB
Diff
29 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Video <videogamesm12@gmail.com>
|
|
Date: Wed, 30 Mar 2022 18:20:09 -0600
|
|
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 2e3220cbbea5f6cb9acb7f8fbaf2ff8f91b09234..3ea83a093f698a055566f45a7927c289ff9a6955 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
@@ -45,6 +45,7 @@ import net.minecraft.nbt.NbtIo;
|
|
import net.minecraft.nbt.StringTag;
|
|
import net.minecraft.nbt.Tag;
|
|
import net.minecraft.network.chat.TextComponent;
|
|
+import net.minecraft.resources.ResourceLocation; // Scissors
|
|
import net.minecraft.world.item.BlockItem;
|
|
import org.apache.commons.codec.binary.Base64;
|
|
import org.apache.commons.lang.Validate;
|
|
@@ -481,7 +482,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
|
|
|
|
String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
|
- if (attributeName == null || attributeName.isEmpty()) {
|
|
+ if (attributeName == null || attributeName.isEmpty() || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
|
continue;
|
|
}
|
|
|