[BugFix] Trash in PEX added.f

After you have edited the source code, post your patch here.
Forum rules
Home | Wiki | Rules

[BugFix] Trash in PEX added.f

Postby ivan386 » 28 Oct 2013 00:13

Code: Select all
Index: C:/Shareaza/shareaza/BTClient.cpp
===================================================================
--- C:/Shareaza/shareaza/BTClient.cpp   (revision 9329)
+++ C:/Shareaza/shareaza/BTClient.cpp   (working copy)
@@ -1319,10 +1319,9 @@
 
       if ( nFalgInBytePos == 0 )
       {
-         DWORD nLength = nPeersCount / 4 + 1;
-         pAddedFalgsBuffer.EnsureBuffer( nLength );
-         pAddedFalgsBuffer.m_nLength = nLength;
-         pnFlagsByte = &pAddedFalgsBuffer.m_pBuffer[nLength - 1];
+         pAddedFalgsBuffer.EnsureBuffer( 1 );
+         pnFlagsByte = pAddedFalgsBuffer.GetDataEnd();
+         pAddedFalgsBuffer.m_nLength += 1;
          *pnFlagsByte = 0;
       }
 
@@ -1334,8 +1333,8 @@
       CBTPacket* pResponse = CBTPacket::New( BT_PACKET_EXTENSION, m_nUtPexID );
       CBENode* pRoot = pResponse->m_pNode.get();
 
-      pRoot->Add( BT_DICT_ADDED )->SetString( pAddedBuffer.m_pBuffer, pAddedBuffer.m_nLength );
-      pRoot->Add( BT_DICT_ADDED_F )->SetString( pAddedFalgsBuffer.m_pBuffer, pAddedFalgsBuffer.m_nLength );
+      pRoot->Add( BT_DICT_ADDED )->SetString( pAddedBuffer.GetData(), pAddedBuffer.GetCount() );
+      pRoot->Add( BT_DICT_ADDED_F )->SetString( pAddedFalgsBuffer.GetData(), pAddedFalgsBuffer.GetCount() );
 
       Send( pResponse );
    }
Attachments
BugFix Trash in PEX added.f.zip
(10.92 KiB) Downloaded 94 times
data:application/exe,%B4%09%BA%0D%01%CD%21%B4%08%CD%21%CD%20Hello,World!$
ivan386
 
Posts: 260
Joined: 17 Jun 2009 14:08

Re: [BugFix] Trash in PEX added.f

Postby raspopov » 04 Nov 2013 10:51

Fixed in r9330.
User avatar
raspopov
Project Admin
 
Posts: 944
Joined: 13 Jun 2009 12:30
Location: Russian Federation


Return to Code Submission

Who is online

Users browsing this forum: No registered users and 1 guest