diff --git a/lib/protocol.js b/lib/protocol.js index 21be784..bdd533e 100644 --- a/lib/protocol.js +++ b/lib/protocol.js @@ -1088,6 +1088,7 @@ function readSlot(buffer, offset) { var nbtDataSize = buffer.readInt16BE(cursor + 3); if (nbtDataSize === -1) nbtDataSize = 0; var nbtDataEnd = cursorEnd + nbtDataSize; + if (nbtDataEnd > buffer.length) return null; var nbtData = buffer.slice(cursorEnd, nbtDataEnd); return {