diff --git a/src/base/system.c b/src/base/system.c index 58d39035c..ccb28d970 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -2377,6 +2377,8 @@ int os_compare_version(int major, int minor) return 0; else return -1; +#else + return 0; // unimplemented #endif } diff --git a/src/engine/external/zlib/gzguts.h b/src/engine/external/zlib/gzguts.h index d87659d03..896394760 100644 --- a/src/engine/external/zlib/gzguts.h +++ b/src/engine/external/zlib/gzguts.h @@ -19,6 +19,7 @@ #endif #include +#include #include "zlib.h" #ifdef STDC # include diff --git a/src/engine/shared/network_conn.cpp b/src/engine/shared/network_conn.cpp index b5a5e2e3f..690a1d32e 100644 --- a/src/engine/shared/network_conn.cpp +++ b/src/engine/shared/network_conn.cpp @@ -203,13 +203,13 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr, SECURITY_ if (State() != NET_CONNSTATE_OFFLINE && m_SecurityToken != NET_SECURITY_TOKEN_UNKNOWN && m_SecurityToken != NET_SECURITY_TOKEN_UNSUPPORTED) { // supposed to have a valid token in this packet, check it - if (pPacket->m_DataSize < sizeof(m_SecurityToken)) + if (pPacket->m_DataSize < (int)sizeof(m_SecurityToken)) return 0; pPacket->m_DataSize -= sizeof(m_SecurityToken); - if (m_SecurityToken != *(SECURITY_TOKEN*)&pPacket->m_aChunkData[pPacket->m_DataSize]) + if (m_SecurityToken != (SECURITY_TOKEN)(pPacket->m_aChunkData[pPacket->m_DataSize])) { if(g_Config.m_Debug) - dbg_msg("security", "token mismatch, expected %d got %d", m_SecurityToken, *(SECURITY_TOKEN*)&pPacket->m_aChunkData[pPacket->m_DataSize]); + dbg_msg("security", "token mismatch, expected %d got %d", m_SecurityToken, (SECURITY_TOKEN)(pPacket->m_aChunkData[pPacket->m_DataSize])); return 0; } } @@ -278,7 +278,7 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr, SECURITY_ m_LastRecvTime = Now; m_LastUpdateTime = Now; if (m_SecurityToken == NET_SECURITY_TOKEN_UNKNOWN - && pPacket->m_DataSize >= 1 + sizeof(SECURITY_TOKEN_MAGIC) + sizeof(m_SecurityToken) + && pPacket->m_DataSize >= (int)(1 + sizeof(SECURITY_TOKEN_MAGIC) + sizeof(m_SecurityToken)) && !mem_comp(&pPacket->m_aChunkData[1], SECURITY_TOKEN_MAGIC, sizeof(SECURITY_TOKEN_MAGIC))) { m_SecurityToken = SecurityToken; @@ -302,10 +302,10 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr, SECURITY_ if(CtrlMsg == NET_CTRLMSG_CONNECTACCEPT) { if (m_SecurityToken == NET_SECURITY_TOKEN_UNKNOWN - && pPacket->m_DataSize >= 1 + sizeof(SECURITY_TOKEN_MAGIC) + sizeof(m_SecurityToken) + && pPacket->m_DataSize >= (int)(1 + sizeof(SECURITY_TOKEN_MAGIC) + sizeof(m_SecurityToken)) && !mem_comp(&pPacket->m_aChunkData[1], SECURITY_TOKEN_MAGIC, sizeof(SECURITY_TOKEN_MAGIC))) { - m_SecurityToken = *(SECURITY_TOKEN*)(&pPacket->m_aChunkData[1 + sizeof(SECURITY_TOKEN_MAGIC)]); + m_SecurityToken = (SECURITY_TOKEN)*(&pPacket->m_aChunkData[1 + sizeof(SECURITY_TOKEN_MAGIC)]); if(g_Config.m_Debug) dbg_msg("security", "got token %d", m_SecurityToken); } diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp index 082e9d362..466729c86 100644 --- a/src/engine/shared/network_server.cpp +++ b/src/engine/shared/network_server.cpp @@ -201,7 +201,7 @@ int CNetServer::Recv(CNetChunk *pChunk) md5_append(&md5, (unsigned char*)&Addr, sizeof(Addr)); md5_append(&md5, (unsigned char*)×tamp, sizeof(timestamp)); md5_finish(&md5, digest); - securityToken = *(SECURITY_TOKEN*)digest; + securityToken = (SECURITY_TOKEN)*digest; timestamp++; } while (securityToken == NET_SECURITY_TOKEN_UNKNOWN || securityToken == NET_SECURITY_TOKEN_UNSUPPORTED);