Even more size_t fixes.
This commit is contained in:
parent
d67ea97a26
commit
294b7ca24a
@ -29,7 +29,7 @@
|
|||||||
// cParsedNBT:
|
// cParsedNBT:
|
||||||
|
|
||||||
#define NEEDBYTES(N) \
|
#define NEEDBYTES(N) \
|
||||||
if (m_Length - m_Pos < N) \
|
if (m_Length - m_Pos < (size_t)N) \
|
||||||
{ \
|
{ \
|
||||||
return false; \
|
return false; \
|
||||||
}
|
}
|
||||||
@ -84,9 +84,9 @@ bool cParsedNBT::ReadString(size_t & a_StringStart, size_t & a_StringLen)
|
|||||||
NEEDBYTES(2);
|
NEEDBYTES(2);
|
||||||
a_StringStart = m_Pos + 2;
|
a_StringStart = m_Pos + 2;
|
||||||
a_StringLen = (size_t)GetBEShort(m_Data + m_Pos);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
m_Pos += 2 + a_StringLen;
|
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)
|
for (int Child = m_Tags[a_Tag].m_FirstChild; Child != -1; Child = m_Tags[Child].m_NextSibling)
|
||||||
{
|
{
|
||||||
if (
|
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)
|
(memcmp(m_Data + m_Tags[Child].m_NameStart, a_Name, a_NameLength) == 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user