diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 2c93748f6..589fb94db 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -1716,16 +1716,8 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket) { if(g_Config.m_Debug) { - char aHex[] = "0123456789ABCDEF"; char aBuf[512]; - - for(int b = 0; b < pPacket->m_DataSize && b < 32; b++) - { - aBuf[b * 3] = aHex[((const unsigned char *)pPacket->m_pData)[b] >> 4]; - aBuf[b * 3 + 1] = aHex[((const unsigned char *)pPacket->m_pData)[b] & 0xf]; - aBuf[b * 3 + 2] = ' '; - aBuf[b * 3 + 3] = 0; - } + str_hex(aBuf, sizeof(aBuf), pPacket->m_pData, minimum(pPacket->m_DataSize, 32)); char aBufMsg[256]; str_format(aBufMsg, sizeof(aBufMsg), "strange message ClientID=%d msg=%d data_size=%d", ClientID, Msg, pPacket->m_DataSize);