diff options
author | Mattes D <github@xoft.cz> | 2014-05-09 20:05:00 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-05-09 20:05:00 +0200 |
commit | 294b7ca24a09b61cbac0bd43d9b287af21848c24 (patch) | |
tree | 64edad7bb5b813b880037e85800917de82ea31be /src/WorldStorage/FastNBT.cpp | |
parent | More size_t fixes. (diff) | |
download | cuberite-294b7ca24a09b61cbac0bd43d9b287af21848c24.tar cuberite-294b7ca24a09b61cbac0bd43d9b287af21848c24.tar.gz cuberite-294b7ca24a09b61cbac0bd43d9b287af21848c24.tar.bz2 cuberite-294b7ca24a09b61cbac0bd43d9b287af21848c24.tar.lz cuberite-294b7ca24a09b61cbac0bd43d9b287af21848c24.tar.xz cuberite-294b7ca24a09b61cbac0bd43d9b287af21848c24.tar.zst cuberite-294b7ca24a09b61cbac0bd43d9b287af21848c24.zip |
Diffstat (limited to '')
-rw-r--r-- | src/WorldStorage/FastNBT.cpp | 8 |
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) ) { |