From b943771cf04d3fa03757249511301b4def355564 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 20 Oct 2015 11:42:24 -0500 Subject: [PATCH 1/4] add stack and buffer protections gcc can build in, so we can be lazy and not replace all the calls to strcpy --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db2930b8..57c36c21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,8 +47,8 @@ if(WIN32) elseif(UNIX) find_package(Curses REQUIRED) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g -pipe -O0 -Wall -Wno-overloaded-virtual -Wno-missing-braces -Wno-unused-private-field -Wno-format -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -Wno-unused-const-variable -Wno-unknown-warning-option") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1 -march=native -pipe -mtune=native -O2 -Wno-overloaded-virtual -Wno-missing-braces -Wno-unused-private-field -Wno-format -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -Wno-unused-const-variable -Wno-unknown-warning-option") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_FORTIFY_SOURCE=2 -fstack-protector -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -g -pipe -O0 -Wall -Wno-overloaded-virtual -Wno-missing-braces -Wno-unused-private-field -Wno-format -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -Wno-unused-const-variable -Wno-unknown-warning-option") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_FORTIFY_SOURCE=2 -fstack-protector -DDEBUG_LEVEL=0 -DPRODUCTION=1 -march=native -pipe -mtune=native -O2 -Wno-overloaded-virtual -Wno-missing-braces -Wno-unused-private-field -Wno-format -Wno-unused-but-set-variable -Wno-write-strings -Wno-unknown-pragmas -Wno-uninitialized -Wno-reorder -Wno-unused-const-variable -Wno-unknown-warning-option") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GLIBCXX_USE_CXX11_ABI=0") add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D__STL_NO_BAD_ALLOC -D_GNU_SOURCE -D_XOPEN_SOURCE=500) From cfd76c732111821cedd98b682759054cecb774ca Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 20 Oct 2015 11:49:39 -0500 Subject: [PATCH 2/4] fix another warn --- .../application/SwgGameServer/src/shared/core/CSHandler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp index 6b1d615d..10376750 100644 --- a/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp +++ b/game/server/application/SwgGameServer/src/shared/core/CSHandler.cpp @@ -85,17 +85,17 @@ namespace CSHandlerNamespace unsigned pos; // where we stop looking unsigned lastpos; // the last character in our argument. // bounds checking. - if( position < 0 || position >= input.length() ) + if( position < 0 || position >= (int) input.length() ) { return ""; } // skip whitespace - while( input[ position ] == ' ' && position < input.length() ) + while( input[ position ] == ' ' && position < (int) input.length() ) { ++position; } - if( position == input.length() ) + if( position == (int) input.length() ) return ""; // see if the first character is a quote. if( input[ position ] == '"' ) From f04a2b48f6ff22460c0be9ea78e28e8c42880317 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 24 Oct 2015 19:31:28 -0700 Subject: [PATCH 3/4] fix some more warnings --- .../src/shared/CentralServer.cpp | 46 +++++++++---------- .../CSAssistgameapi/CSAssistgameapicore.cpp | 11 +++-- .../CTGenericAPI/GenericApiCore.cpp | 2 - 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index ec59cdf1..7e0ea1cd 100644 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -979,39 +979,37 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons GameServerConnection *g = const_cast(safe_cast(&source)); - FATAL(ConfigCentralServer::getValidateBuildVersionNumber() && strcmp(ApplicationVersion::getInternalVersion(), c.getBuildVersionNumber().c_str()), - ("Build version number mismatch: central server (%s), remote server %s (%s)", ApplicationVersion::getInternalVersion(), g->getRemoteAddress().c_str(), c.getBuildVersionNumber().c_str()) - ); + if (g != nullptr) { - // a game server (or db process) has connected... - addGameServer(g); + FATAL(ConfigCentralServer::getValidateBuildVersionNumber() && strcmp(ApplicationVersion::getInternalVersion(), c.getBuildVersionNumber().c_str()), + ("Build version number mismatch: central server (%s), remote server %s (%s)", + ApplicationVersion::getInternalVersion(), g->getRemoteAddress().c_str(), c.getBuildVersionNumber().c_str())); - //Send connection server data - ConnectionServerConnectionList::iterator i = m_connectionServerConnections.begin(); - for(; i != m_connectionServerConnections.end(); ++i) - { - if ((*i)->getGameServicePort() != 0) + // a game server (or db process) has connected... + addGameServer(g); + + //Send connection server data + ConnectionServerConnectionList::iterator i = m_connectionServerConnections.begin(); + for (; i != m_connectionServerConnections.end(); ++i) { - ConnectionServerAddress csa((*i)->getGameServiceAddress(), (*i)->getGameServicePort()); - g->send(csa, true); + if ((*i)->getGameServicePort() != 0) + { + ConnectionServerAddress csa((*i)->getGameServiceAddress(), (*i)->getGameServicePort()); + g->send(csa, true); + } } - } - std::set::const_iterator chatIter; - for(chatIter = m_chatServerConnections.begin(); chatIter != m_chatServerConnections.end(); ++chatIter) - { - if((*chatIter)->getGameServicePort()) + std::set::const_iterator chatIter; + for (chatIter = m_chatServerConnections.begin(); chatIter != m_chatServerConnections.end(); ++chatIter) { - ChatServerOnline cso((*chatIter)->getRemoteAddress(), (*chatIter)->getGameServicePort()); - g->send(cso, true); + if ((*chatIter)->getGameServicePort()) + { + ChatServerOnline cso((*chatIter)->getRemoteAddress(), (*chatIter)->getGameServicePort()); + g->send(cso, true); + } } - } - if (g != NULL) - { - //DEBUG_REPORT_LOG(true, ("CentralServer: Sending CustomerServiceServerGameServerServiceAddress to game server (%s:%d) pid(%i)\n", g->getRemoteAddress().c_str(), g->getRemotePort(), g->getProcessId())); const GenericValueTypeMessage > address("CustomerServiceServerGameServerServiceAddress", std::make_pair(s_customerServiceServerGameServerServiceAddress.first, s_customerServiceServerGameServerServiceAddress.second)); - g->send(address, true); } } diff --git a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.cpp b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.cpp index 6d486c33..3ba14e6b 100644 --- a/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.cpp +++ b/external/3rd/library/soePlatform/CSAssist/projects/CSAssist/CSAssistgameapi/CSAssistgameapicore.cpp @@ -113,7 +113,12 @@ CSAssistGameAPIcore::CSAssistGameAPIcore(CSAssistGameAPI *api, const char *serve /////////////////////////////////////////// // populate server list - int size = ::strlen(serverList); + int size = 0; + + if (serverList != nullptr) { + size = ::strlen(serverList); + } + if (!serverList || (size <= 0)) { fprintf(stderr, "CSASsistGameAPIcore()::serverList==NULL! aborting...\n"); @@ -151,10 +156,10 @@ CSAssistGameAPIcore::CSAssistGameAPIcore(CSAssistGameAPI *api, const char *serve m_serverList.push_back(sid); } //fprintf(stderr, "res=%d, p=%s, host=%s, port=%d, size=%d\n", res, p, host, port, m_serverList.size()); - delete p; + delete [] p; } delete host; - delete buf; + delete [] buf; m_curServer = m_serverList.begin(); GetLBHost(); // diff --git a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp index 6c412225..1756235a 100644 --- a/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp +++ b/external/3rd/library/soePlatform/CTServiceGameAPI/CTGenericAPI/GenericApiCore.cpp @@ -97,8 +97,6 @@ GenericAPICore::~GenericAPICore() delete (*iter).second; } - m_pending.empty(); - while(m_outCount > 0) { delete m_outboundQueue.front().second; From 7155dc1a1c22d91a031053cea1fdf999cd9da689 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 24 Oct 2015 21:28:26 -0700 Subject: [PATCH 4/4] some more fixes to test --- .../ATGenericAPI/GenericApiCore.cpp | 2 - .../src/shared/CentralServer.cpp | 93 ++++++++------- .../ChatServer/src/shared/ChatServer.cpp | 111 +++++++++--------- .../utils/GenericAPI/GenericApiCore.cpp | 2 - .../utils/UdpLibrary/UdpConnection.cpp | 2 +- .../utils/UdpLibrary/UdpDriverWindows.cpp | 20 ++-- .../ChatAPI/utils/UdpLibrary/UdpMisc.cpp | 8 +- 7 files changed, 124 insertions(+), 114 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp index 6c412225..1756235a 100644 --- a/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp +++ b/engine/server/application/CentralServer/src/shared/AuctionTransferGameAPI/ATGenericAPI/GenericApiCore.cpp @@ -97,8 +97,6 @@ GenericAPICore::~GenericAPICore() delete (*iter).second; } - m_pending.empty(); - while(m_outCount > 0) { delete m_outboundQueue.front().second; diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 7e0ea1cd..7f47da7e 100644 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -2569,53 +2569,60 @@ void CentralServer::removeConnectionServerConnection(const ConnectionServerConne */ void CentralServer::removeGameServer(GameServerConnection const *gameServer) { - uint32 const pid = gameServer->getProcessId(); - - LOG("ServerStartup", ("Game Server %lu went down", pid)); - - //@todo this whole function needs a re-write. - NOT_NULL(gameServer); - std::map::iterator const i = m_gameServerConnections.find(pid); - if (i == m_gameServerConnections.end()) - return; - - for (std::vector::iterator ii = m_gameServerConnectionsList.begin(); ii != m_gameServerConnectionsList.end();) + if (gameServer != nullptr) { - if ((*ii) == i->second) - ii = m_gameServerConnectionsList.erase(ii); - else - ++ii; + uint32 const pid = gameServer->getProcessId(); + + LOG("ServerStartup", ("Game Server %lu went down", pid)); + + //@todo this whole function needs a re-write. + NOT_NULL(gameServer); + std::map::iterator const i = m_gameServerConnections.find(pid); + if (i == m_gameServerConnections.end()) + return; + + for (std::vector::iterator ii = m_gameServerConnectionsList.begin(); ii != m_gameServerConnectionsList.end();) + { + if ((*ii) == i->second) + ii = m_gameServerConnectionsList.erase(ii); + else + ++ii; + } + + m_gameServerConnections.erase(i); + + /** @todo: this is slow, find a better way (probably by creating reverse + * lookup table(s)) + */ + if (pid == m_dbProcessServerProcessId) + { + DEBUG_REPORT_LOG(true, ("Database process died -- Central will exit and let the cluster restart\n")); + m_done = true; + return; //lint !e527 Unreachable + } + + DEBUG_WARNING(true, ("Game server %lu crashed", pid)); + + for (SceneGameMap::iterator j = m_gameServers.begin(); j != m_gameServers.end();) + { + if ((*j).second == gameServer) + m_gameServers.erase(j++); + else + ++j; + } + + UniverseManager::getInstance().onGameServerDisconnect(*gameServer); + PlanetManager::onGameServerDisconnect(gameServer); + CharacterCreationTracker::getInstance().onGameServerDisconnect(pid); + ClusterWideDataManagerList::onGameServerDisconnect(pid); + + ExcommunicateGameServerMessage const excommunicateMessage(pid, 0, ""); + sendToAllGameServersExceptDBProcess(excommunicateMessage, true); } - - m_gameServerConnections.erase(i); - - /** @todo: this is slow, find a better way (probably by creating reverse - * lookup table(s)) - */ - if (pid == m_dbProcessServerProcessId) + else { - DEBUG_REPORT_LOG(true, ("Database process died -- Central will exit and let the cluster restart\n")); - m_done = true; - return; //lint !e527 Unreachable + DEBUG_WARNING(true, ("A game server crashed but our process ID ptr is null.")); } - - DEBUG_WARNING(true, ("Game server %lu crashed", pid)); - - for (SceneGameMap::iterator j = m_gameServers.begin(); j != m_gameServers.end();) - { - if ((*j).second == gameServer) - m_gameServers.erase(j++); - else - ++j; - } - - UniverseManager::getInstance().onGameServerDisconnect(*gameServer); - PlanetManager::onGameServerDisconnect(gameServer); - CharacterCreationTracker::getInstance().onGameServerDisconnect(pid); - ClusterWideDataManagerList::onGameServerDisconnect(pid); - - ExcommunicateGameServerMessage const excommunicateMessage(pid, 0, ""); - sendToAllGameServersExceptDBProcess(excommunicateMessage, true); } //----------------------------------------------------------------------- diff --git a/engine/server/application/ChatServer/src/shared/ChatServer.cpp b/engine/server/application/ChatServer/src/shared/ChatServer.cpp index d4752eda..9d4ee5c8 100644 --- a/engine/server/application/ChatServer/src/shared/ChatServer.cpp +++ b/engine/server/application/ChatServer/src/shared/ChatServer.cpp @@ -1810,72 +1810,75 @@ void ChatServer::removeAvatarFromRoom(const NetworkId & id, const ChatAvatarId & ChatServer::fileLog(s_enableChatRoomLogs, "ChatServer", "removeAvatarFromRoom() id(%s) avatarName(%s) roomName(%s)", id.getValueString().c_str(), avatarName.getFullName().c_str(), roomName.c_str()); const ChatAvatar * avatar = getAvatarByNetworkId(id); - ChatAvatarId removerId; - makeAvatarId(*avatar, removerId); - size_t pos = roomName.rfind("."); - std::string leaf; - if(pos != std::string::npos) - { - leaf = toLower(roomName.substr(pos)); - } - //REPORT_LOG(true, ("removeAvatarFromRoom()\n")); - if(avatar) - { - bool removeAvatar = false; - if(avatarName == removerId) + if (avatar != nullptr) { + ChatAvatarId removerId; + makeAvatarId(*avatar, removerId); + size_t pos = roomName.rfind("."); + std::string leaf; + if (pos != std::string::npos) { - // avatar is attempting to remove self from the room - if(leaf != ".system") - removeAvatar = true; + leaf = toLower(roomName.substr(pos)); } - else if(isGod(id)) + //REPORT_LOG(true, ("removeAvatarFromRoom()\n")); + + if (avatar) { - removeAvatar = true; - } - else - { - const ChatServerRoomOwner * r = instance().chatInterface->getRoomByName(roomName); - if(r) + bool removeAvatar = false; + if (avatarName == removerId) { - // if the avatar is the room owner, remove the target - if( r->getRoomData().owner == removerId ) - { + // avatar is attempting to remove self from the room + if (leaf != ".system") removeAvatar = true; - } - // if the avatar is the room creator, remove the target - else if( r->getRoomData().creator == removerId ) + } + else if (isGod(id)) + { + removeAvatar = true; + } + else + { + const ChatServerRoomOwner * r = instance().chatInterface->getRoomByName(roomName); + if (r) { - removeAvatar = true; - } - // if the avatar is a moderator, remove the target - else - { -/*MLSTODO if(r->getRoom()) + // if the avatar is the room owner, remove the target + if (r->getRoomData().owner == removerId) { - AvatarIterator i = r->getRoom()->getFirstModerator(); - for(; !i.outOfBounds(); ++i) - { - ChatAvatarId tmpAvatarId; - makeAvatarId(*(*i), tmpAvatarId); - if(tmpAvatarId == removerId) - { - removeAvatar = true; - break; - } - } + removeAvatar = true; + } + // if the avatar is the room creator, remove the target + else if (r->getRoomData().creator == removerId) + { + removeAvatar = true; + } + // if the avatar is a moderator, remove the target + else + { + /*MLSTODO if(r->getRoom()) + { + AvatarIterator i = r->getRoom()->getFirstModerator(); + for(; !i.outOfBounds(); ++i) + { + ChatAvatarId tmpAvatarId; + makeAvatarId(*(*i), tmpAvatarId); + if(tmpAvatarId == removerId) + { + removeAvatar = true; + break; + } + } + } + */ } - */ } } - } - if(removeAvatar) - { - const ChatServerRoomOwner * r = instance().chatInterface->getRoomByName(roomName); - const NetworkId &id = getNetworkIdByAvatarId(avatarName); - if (r) + if (removeAvatar) { - leaveRoom(id, 0, r->getRoomData().id); + const ChatServerRoomOwner * r = instance().chatInterface->getRoomByName(roomName); + const NetworkId &id = getNetworkIdByAvatarId(avatarName); + if (r) + { + leaveRoom(id, 0, r->getRoomData().id); + } } } } diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.cpp index d41c0d5b..36dd1c4b 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/GenericAPI/GenericApiCore.cpp @@ -81,8 +81,6 @@ GenericAPICore::~GenericAPICore() delete (*iter).second; } - m_pending.empty(); - while(m_outCount > 0) { delete m_outboundQueue.front().second; diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp index 6b2fce79..c9952e9a 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpConnection.cpp @@ -542,7 +542,7 @@ void UdpConnection::ProcessRawPacket(const UdpManager::PacketHistoryEntry *e) wantCrc = UdpMisc::GetValue32(crcPtr); break; } - if (wantCrc != actualCrc) + if (wantCrc != actualCrc && mUdpManager != nullptr) { mConnectionStats.crcRejectedPackets++; mUdpManager->IncrementCrcRejectedPackets(); diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp index ed4b0ea7..04c0c4d0 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpDriverWindows.cpp @@ -383,14 +383,18 @@ UdpPlatformAddress &UdpPlatformAddress::operator=(const UdpPlatformAddress &e) char *UdpPlatformAddress::GetAddress(char *buffer, int bufferLen) const { - if (bufferLen < 16) - { - *buffer = 0; - return(buffer); - } - assert(buffer != NULL); - sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); - return(buffer); + if (buffer != nullptr) { + if (bufferLen < 16) + { + *buffer = 0; + return(buffer); + } + assert(buffer != NULL); + sprintf(buffer, "%d.%d.%d.%d", mData[0], mData[1], mData[2], mData[3]); + return(buffer); + } + + return nullptr; } void UdpPlatformAddress::SetAddress(const char *address) diff --git a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp index 15718755..a88ab603 100644 --- a/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp +++ b/external/3rd/library/soePlatform/ChatAPI/utils/UdpLibrary/UdpMisc.cpp @@ -87,10 +87,10 @@ int UdpMisc::Crc32(const void *buffer, int bufferLen, int encryptValue) 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D}; int crc = 0xffffffff; - crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ (encryptValue & 0xff)) & 0x000000FFL]; - crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ ((encryptValue >> 8) & 0xff)) & 0x000000FFL]; - crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ ((encryptValue >> 16) & 0xff)) & 0x000000FFL]; - crc = ((crc >> 8) & 0x00FFFFFFL) ^ crc32_table[(crc ^ ((encryptValue >> 24) & 0xff)) & 0x000000FFL]; + crc = (crc >> (8 & 0x00FFFFFFL)) ^ crc32_table[(crc ^ (encryptValue & 0xff)) & 0x000000FFL]; + crc = (crc >> (8 & 0x00FFFFFFL)) ^ crc32_table[(crc ^ ((encryptValue >> 8) & 0xff)) & 0x000000FFL]; + crc = (crc >> (8 & 0x00FFFFFFL)) ^ crc32_table[(crc ^ ((encryptValue >> 16) & 0xff)) & 0x000000FFL]; + crc = (crc >> (8 & 0x00FFFFFFL)) ^ crc32_table[(crc ^ ((encryptValue >> 24) & 0xff)) & 0x000000FFL]; const udp_uchar *bufPtr = (const udp_uchar *)buffer; const udp_uchar *endPtr = (const udp_uchar *)buffer + bufferLen;