diff --git a/patches/server/0039-Paper-Add-another-slot-sanity-check.patch b/patches/server/0039-Paper-Add-another-slot-sanity-check.patch new file mode 100644 index 000000000..4a8ca182b --- /dev/null +++ b/patches/server/0039-Paper-Add-another-slot-sanity-check.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> +Date: Sat, 11 Nov 2023 03:50:55 -0500 +Subject: [PATCH] Paper: Add another slot sanity check + +Original code by PaperMC, licensed under GPL v3 +You can find the original code on https://github.com/PaperMC/Paper/commit/8493340be4fa69fa9369719272e5dff1b7a2f455 + +This patch fixed a packet exploit that affects 1.20.1/2 + +diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +index 38d47fbcd49cc291040ea00470abeb982fe2714c..662f3eee6ff17e0b0191b1c59066465db818ed2b 100644 +--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java ++++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +@@ -600,7 +600,7 @@ public abstract class AbstractContainerMenu { + int j2; + + if (actionType == ClickType.SWAP) { +- if (slotIndex < 0) return; // Paper ++ if (slotIndex < 0 || button < 0) return; // Paper + slot2 = (Slot) this.slots.get(slotIndex); + itemstack1 = playerinventory.getItem(button); + itemstack = slot2.getItem();