summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/WorldStorage/FastNBT.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp
index c4a6a7a5b..a047d67c7 100644
--- a/src/WorldStorage/FastNBT.cpp
+++ b/src/WorldStorage/FastNBT.cpp
@@ -29,7 +29,7 @@
// cParsedNBT:
#define NEEDBYTES(N) \
- if (m_Length - m_Pos < N) \
+ if (m_Length - m_Pos < (size_t)N) \
{ \
return false; \
}
@@ -84,9 +84,9 @@ bool cParsedNBT::ReadString(size_t & a_StringStart, size_t & a_StringLen)
NEEDBYTES(2);
a_StringStart = m_Pos + 2;
a_StringLen = (size_t)GetBEShort(m_Data + m_Pos);
- if (a_StringLen < 0)
+ if (a_StringLen > 0xffff)
{
- // Invalid string length
+ // Suspicious string length
return false;
}
m_Pos += 2 + a_StringLen;
@@ -281,7 +281,7 @@ int cParsedNBT::FindChildByName(int a_Tag, const char * a_Name, size_t a_NameLen
for (int Child = m_Tags[a_Tag].m_FirstChild; Child != -1; Child = m_Tags[Child].m_NextSibling)
{
if (
- (m_Tags[Child].m_NameLength == (int)a_NameLength) &&
+ (m_Tags[Child].m_NameLength == a_NameLength) &&
(memcmp(m_Data + m_Tags[Child].m_NameStart, a_Name, a_NameLength) == 0)
)
{