• Congratulations to the OTLand January Mapping Competition Winner! The grand prize of Otland Premium goes to Andréew.
  • Sign up for February Mapping Competition! The prize includes Otland Premium time.
  • There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Fix/Patch 7.6 Yurots Crash Fix

Wirless

7.6 is the best :D
Joined
Nov 3, 2012
Messages
1,024
Best answers
1
Reaction score
194
Location
Ireland-Poland
replace NetworkMessage:GetRaw to
std::string NetworkMessage::GetRaw(){
int stringlen = m_MsgSize- m_ReadPos;
if ((stringlen >= (16384 - m_ReadPos)) || stringlen <=0)
return std::string();

char* v = (char*)(m_MsgBuf+m_ReadPos);
m_ReadPos += stringlen;
return std::string(v, stringlen);
}
#else
std::string NetworkMessage::GetRaw(){
int stringlen = m_MsgSize- m_ReadPos;
if (stringlen >= (16384 - m_ReadPos))
return std::string();

char* v = (char*)(m_MsgBuf+m_ReadPos);
m_ReadPos += stringlen;
return std::string(v, stringlen);
}
 

4drik

Advanced OT User
Joined
Jun 30, 2014
Messages
219
Best answers
0
Reaction score
164
Jak juz poprawiac to zabierzmy sie za to konkretnie :)
C++:
std::string NetworkMessage::GetString()
{
    int stringlen = GetU16();
    if(stringlen >= (16384 - m_ReadPos))
        return std::string();

    char* v = (char*)(m_MsgBuf + m_ReadPos);
    m_ReadPos += stringlen;
    return std::string(v, stringlen);
}
Na:
C++:
std::string NetworkMessage::GetString(uint16_t stringlen/* = 0*/)
{
    if(stringlen == 0)
        stringlen = GetU16();

    if((stringlen >= (16384 - m_ReadPos)) || stringlen <= 0)
        return std::string();

    char* v = (char*)(m_MsgBuf + m_ReadPos);
    m_ReadPos += stringlen;
    return std::string(v, stringlen);
}
C++:
std::string    GetString();
Na:
C++:
std::string GetString(uint16_t stringlen = 0);
C++:
std::string NetworkMessage::GetRaw()
{
    int stringlen = m_MsgSize - m_ReadPos;
    if((stringlen >= (16384 - m_ReadPos)) || stringlen <= 0)
        return std::string();

    char* v = (char*)(m_MsgBuf + m_ReadPos);
    m_ReadPos += stringlen;
    return std::string(v, stringlen);
}
Na:
C++:
std::string NetworkMessage::GetRaw()
{
    return GetString(m_MsgSize - m_ReadPos);
}
 
OP
Wirless

Wirless

7.6 is the best :D
Joined
Nov 3, 2012
Messages
1,024
Best answers
1
Reaction score
194
Location
Ireland-Poland
Jak juz poprawiac to zabierzmy sie za to konkretnie :)
C++:
std::string NetworkMessage::GetString()
{
    int stringlen = GetU16();
    if(stringlen >= (16384 - m_ReadPos))
        return std::string();

    char* v = (char*)(m_MsgBuf + m_ReadPos);
    m_ReadPos += stringlen;
    return std::string(v, stringlen);
}
Na:
C++:
std::string NetworkMessage::GetString(uint16_t stringlen/* = 0*/)
{
    if(stringlen == 0)
        stringlen = GetU16();

    if((stringlen >= (16384 - m_ReadPos)) || stringlen <= 0)
        return std::string();

    char* v = (char*)(m_MsgBuf + m_ReadPos);
    m_ReadPos += stringlen;
    return std::string(v, stringlen);
}
C++:
std::string    GetString();
Na:
C++:
std::string GetString(uint16_t stringlen = 0);
C++:
std::string NetworkMessage::GetRaw()
{
    int stringlen = m_MsgSize - m_ReadPos;
    if((stringlen >= (16384 - m_ReadPos)) || stringlen <= 0)
        return std::string();

    char* v = (char*)(m_MsgBuf + m_ReadPos);
    m_ReadPos += stringlen;
    return std::string(v, stringlen);
}
Na:
C++:
std::string NetworkMessage::GetRaw()
{
    return GetString(m_MsgSize - m_ReadPos);
}
twoj jebnie
 

4drik

Advanced OT User
Joined
Jun 30, 2014
Messages
219
Best answers
0
Reaction score
164
W jaki sposob?
 

4drik

Advanced OT User
Joined
Jun 30, 2014
Messages
219
Best answers
0
Reaction score
164
Hello, there's my last edit:
C++:
std::string NetworkMessage::GetString(uint16_t stringlen/* = 0*/, bool getRaw/* = false*/)
{
    if(getRaw == false)
        stringlen = GetU16();

    if((stringlen >= (16384 - m_ReadPos)) || stringlen <= 0)
        return std::string();

    char* v = (char*)(m_MsgBuf + m_ReadPos);
    m_ReadPos += stringlen;
    return std::string(v, stringlen);
}

std::string NetworkMessage::GetRaw()
{
    return GetString(m_MsgSize - m_ReadPos, true);
}
And in networkmessage.h:
C++:
 std::string GetString(uint16_t stringlen = 0, bool getRaw = false);
 

gianflogao

Member
Joined
Jun 6, 2014
Messages
135
Best answers
2
Reaction score
11
Hello, there's my last edit:
C++:
std::string NetworkMessage::GetString(uint16_t stringlen/* = 0*/, bool getRaw/* = false*/)
{
    if(getRaw == false)
        stringlen = GetU16();

    if((stringlen >= (16384 - m_ReadPos)) || stringlen <= 0)
        return std::string();

    char* v = (char*)(m_MsgBuf + m_ReadPos);
    m_ReadPos += stringlen;
    return std::string(v, stringlen);
}

std::string NetworkMessage::GetRaw()
{
    return GetString(m_MsgSize - m_ReadPos, true);
}
And in networkmessage.h:
C++:
 std::string GetString(uint16_t stringlen = 0, bool getRaw = false);

if I do that, won't they be able to break in?

have other invasions in yurOTS 7.6?
 
Top