summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/FastNBT.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-21 22:25:01 +0100
committerMattes D <github@xoft.cz>2014-12-21 22:25:01 +0100
commite192da5316e5617a5fd597d4de9181a36b5e4c2e (patch)
tree99d5b1aa5cd95d8a7b05626fc6e911c66a8d7ec9 /src/WorldStorage/FastNBT.cpp
parentcChunk: Fixed missing initialization. (diff)
downloadcuberite-e192da5316e5617a5fd597d4de9181a36b5e4c2e.tar
cuberite-e192da5316e5617a5fd597d4de9181a36b5e4c2e.tar.gz
cuberite-e192da5316e5617a5fd597d4de9181a36b5e4c2e.tar.bz2
cuberite-e192da5316e5617a5fd597d4de9181a36b5e4c2e.tar.lz
cuberite-e192da5316e5617a5fd597d4de9181a36b5e4c2e.tar.xz
cuberite-e192da5316e5617a5fd597d4de9181a36b5e4c2e.tar.zst
cuberite-e192da5316e5617a5fd597d4de9181a36b5e4c2e.zip
Diffstat (limited to 'src/WorldStorage/FastNBT.cpp')
-rw-r--r--src/WorldStorage/FastNBT.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp
index ed8e8bb14..aaef2fdfe 100644
--- a/src/WorldStorage/FastNBT.cpp
+++ b/src/WorldStorage/FastNBT.cpp
@@ -10,6 +10,13 @@
+/** If a list being loaded has more than this number of items, it's considered corrupted. */
+static const int MAX_LIST_ITEMS = 10000;
+
+
+
+
+
// The number of NBT tags that are reserved when an NBT parsing is started.
// You can override this by using a cmdline define
#ifndef NBT_RESERVE_SIZE
@@ -142,7 +149,7 @@ bool cParsedNBT::ReadList(eTagType a_ChildrenType)
NEEDBYTES(4);
int Count = GetBEInt(m_Data + m_Pos);
m_Pos += 4;
- if (Count < 0)
+ if ((Count < 0) || (Count > MAX_LIST_ITEMS))
{
return false;
}