2022-07-28 03:57:50 +00:00
|
|
|
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
|
2023-04-13 23:31:29 +00:00
|
|
|
index e3d5ded703be73343d821f329175710609dc388f..7c04bab95a49c527831949c9618ab96320b1b7ad 100644
|
2022-07-28 03:57:50 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
|
|
@@ -46,6 +46,7 @@ import net.minecraft.nbt.NbtIo;
|
|
|
|
import net.minecraft.nbt.StringTag;
|
|
|
|
import net.minecraft.nbt.Tag;
|
|
|
|
import net.minecraft.network.chat.Component;
|
|
|
|
+import net.minecraft.resources.ResourceLocation;
|
|
|
|
import net.minecraft.world.item.BlockItem;
|
|
|
|
import org.apache.commons.lang.Validate;
|
|
|
|
import org.apache.commons.lang3.EnumUtils;
|
2023-04-13 23:31:29 +00:00
|
|
|
@@ -484,7 +485,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
2022-07-28 03:57:50 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|