From 5a2a25f4991d0a0d76dd6304cbe46b5d337b0cfb Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 3 Sep 2009 08:57:21 +0000 Subject: fix for #551 git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3473 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/dcc/send.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/modules/dcc/send.cpp') diff --git a/src/modules/dcc/send.cpp b/src/modules/dcc/send.cpp index fbf900c90..baab4457f 100644 --- a/src/modules/dcc/send.cpp +++ b/src/modules/dcc/send.cpp @@ -471,6 +471,11 @@ void KviDccSendThread::updateStats() m_pMutex->unlock(); } +union _ack_buffer { + char cAckBuffer[4]; + quint32 i32AckBuffer; +}; + void KviDccSendThread::run() { m_pTimeInterval->mark(); @@ -481,7 +486,7 @@ void KviDccSendThread::run() m_iTotalSentBytes = 0; m_iInstantSentBytes = 0; int iFailedSelects = 0; - char ackbuffer[4]; + _ack_buffer ackbuffer; int iBytesInAckBuffer = 0; quint32 iLastAck = 0; @@ -541,13 +546,13 @@ void KviDccSendThread::run() if(!m_pOpt->bNoAcks) { int iAckBytesToRead = 4 - iBytesInAckBuffer; - int readLen = kvi_socket_recv(m_fd,(void *)(ackbuffer + iBytesInAckBuffer),iAckBytesToRead); + int readLen = kvi_socket_recv(m_fd,(void *)(ackbuffer.cAckBuffer + iBytesInAckBuffer),iAckBytesToRead); if(readLen > 0) { iBytesInAckBuffer += readLen; if(iBytesInAckBuffer == 4) { - quint32 iNewAck = ntohl(*((quint32 *)ackbuffer)); + quint32 iNewAck = ntohl(ackbuffer.i32AckBuffer); if((iNewAck > pFile->pos()) || (iNewAck < iLastAck)) { // the peer is drunk or is trying to fool us -- cgit v1.3.1-10-gc9f91