Fuzzing options

This commit is contained in:
def 2014-12-06 16:17:04 +01:00
parent 8275f2d811
commit 366f0281ed
2 changed files with 4 additions and 0 deletions

View file

@ -121,12 +121,14 @@ void CNetBase::SendPacket(NETSOCKET Socket, NETADDR *pAddr, CNetPacketConstruct
CompressedSize = ms_Huffman.Compress(pPacket->m_aChunkData, pPacket->m_DataSize, &aBuffer[3], NET_MAX_PACKETSIZE-4); CompressedSize = ms_Huffman.Compress(pPacket->m_aChunkData, pPacket->m_DataSize, &aBuffer[3], NET_MAX_PACKETSIZE-4);
// check if the compression was enabled, successful and good enough // check if the compression was enabled, successful and good enough
#ifndef FUZZING
if(CompressedSize > 0 && CompressedSize < pPacket->m_DataSize) if(CompressedSize > 0 && CompressedSize < pPacket->m_DataSize)
{ {
FinalSize = CompressedSize; FinalSize = CompressedSize;
pPacket->m_Flags |= NET_PACKETFLAG_COMPRESSION; pPacket->m_Flags |= NET_PACKETFLAG_COMPRESSION;
} }
else else
#endif
{ {
// use uncompressed data // use uncompressed data
FinalSize = pPacket->m_DataSize; FinalSize = pPacket->m_DataSize;

View file

@ -249,8 +249,10 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
mem_copy(&nAddr, pAddr, sizeof(nAddr)); mem_copy(&nAddr, pAddr, sizeof(nAddr));
nAddr.port = 0; nAddr.port = 0;
m_PeerAddr.port = 0; m_PeerAddr.port = 0;
#ifndef FUZZING
if(net_addr_comp(&m_PeerAddr, &nAddr) == 0 && time_get() - m_LastUpdateTime < time_freq() * 3) if(net_addr_comp(&m_PeerAddr, &nAddr) == 0 && time_get() - m_LastUpdateTime < time_freq() * 3)
return 0; return 0;
#endif
// send response and init connection // send response and init connection
Reset(); Reset();