From aa7aee9dd779803e18aec67cbfc199661dbd1fb5 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Tue, 24 Nov 2020 12:05:27 -0500 Subject: [PATCH] Add another validation case although it's not strictly required --- .../proxy/protocol/packet/AvailableCommands.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/AvailableCommands.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/AvailableCommands.java index 1bbef5e5d..dc5e86ff5 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/AvailableCommands.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/AvailableCommands.java @@ -220,13 +220,13 @@ public class AvailableCommands implements MinecraftPacket { // Ensure all children exist. Note that we delay checking if the node has been built yet; // that needs to come after this node is built. for (int child : children) { - if (child >= wireNodes.length) { + if (child < 0 || child >= wireNodes.length) { throw new IllegalStateException("Node points to non-existent index " + redirectTo); } } if (redirectTo != -1) { - if (redirectTo >= wireNodes.length) { + if (redirectTo < 0 || redirectTo >= wireNodes.length) { throw new IllegalStateException("Node points to non-existent index " + redirectTo); } }