diff --git a/common/src/main/java/io/github/wouink/furnish/network/C2S_UpdateItemStack.java b/common/src/main/java/io/github/wouink/furnish/network/C2S_UpdateItemStack.java index 5cd1ac9..871b0a9 100644 --- a/common/src/main/java/io/github/wouink/furnish/network/C2S_UpdateItemStack.java +++ b/common/src/main/java/io/github/wouink/furnish/network/C2S_UpdateItemStack.java @@ -4,6 +4,7 @@ import dev.architectury.networking.simple.BaseC2SMessage; import dev.architectury.networking.simple.MessageType; import io.github.wouink.furnish.Furnish; +import io.github.wouink.furnish.item.Letter; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.item.ItemStack; @@ -46,8 +47,13 @@ public void write(FriendlyByteBuf buf) { @Override public void handle(NetworkManager.PacketContext context) { context.queue(() -> { - context.getPlayer().getInventory().setItem(slot, newStack); - context.getPlayer().getInventory().setChanged(); + /** + PATCH: Fixed security vulnerability allowing arbitrary spawning of items in this packet by ensuring proper validation. + **/ + if (newStack.getItem() instanceof Letter) { + context.getPlayer().getInventory().setItem(slot, newStack); + context.getPlayer().getInventory().setChanged(); + } }); } -} +} \ No newline at end of file