2008-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Added handling for the return values from
	PeerMessageUtil::createcompact().
	* src/DefaultBtContext.cc (computeFastSet):
pull/1/head
Tatsuhiro Tsujikawa 2008-02-21 00:56:14 +00:00
parent 3274b6acc7
commit 24b91983e1
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2008-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added handling for the return values from
PeerMessageUtil::createcompact().
* src/DefaultBtContext.cc (computeFastSet):
2008-02-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed abort when peer's ip address is IPv4-mapped address.

View File

@ -387,7 +387,9 @@ std::deque<int32_t> DefaultBtContext::computeFastSet(const std::string& ipaddr,
{
std::deque<int32_t> fastSet;
char compact[6];
PeerMessageUtil::createcompact(compact, ipaddr, 0);
if(!PeerMessageUtil::createcompact(compact, ipaddr, 0)) {
return fastSet;
}
unsigned char tx[24];
memcpy(tx, compact, 4);
if((tx[0] & 0x80) == 0 || (tx[0] & 0x40) == 0) {