From 589cf1ddaffc9d127bc5d7c931d71b3ad1c476eb Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Mon, 15 Aug 2022 09:53:06 +0200 Subject: [PATCH] lib/nbt: NBT validator: Fix wrong function declaration in the header, fix not using the currentPosition variable when accessing data --- src/lib/nbt.cpp | 2 +- src/lib/nbt.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/nbt.cpp b/src/lib/nbt.cpp index 6a8a329..1c91f35 100644 --- a/src/lib/nbt.cpp +++ b/src/lib/nbt.cpp @@ -777,7 +777,7 @@ namespace NBT { return false; } - switch (data[0]) { + switch (data[currentPosition]) { case TagType::INT8: case TagType::INT16: case TagType::INT32: diff --git a/src/lib/nbt.hpp b/src/lib/nbt.hpp index b473112..b40d804 100644 --- a/src/lib/nbt.hpp +++ b/src/lib/nbt.hpp @@ -113,5 +113,5 @@ namespace NBT { bool validate(uint8_t data[]); }; - bool validateRawNBTData(uint8_t data[], uint64_t dataSize, uint64_t initialPosition, uint64_t* processedDataSize=nullptr); + bool validateRawNBTData(uint8_t data[], uint64_t dataSize, uint64_t initialPosition=0, uint64_t* processedDataSize=nullptr); }