test: Fix stack overflow

pull/141/head
Tatsuhiro Tsujikawa 2013-10-06 21:08:20 +09:00
parent 3080af7370
commit c2ae77dff4
1 changed files with 2 additions and 2 deletions

View File

@ -63,12 +63,12 @@ void DefaultBtMessageFactoryTest::testCreateBtMessage_BtExtendedMessage()
memcpy(msg+6, payload.c_str(), payload.size()); memcpy(msg+6, payload.c_str(), payload.size());
auto m = auto m =
factory_->createBtMessage((const unsigned char*)msg+4, sizeof(msg)); factory_->createBtMessage((const unsigned char*)msg+4, sizeof(msg)-4);
CPPUNIT_ASSERT(BtExtendedMessage::ID == m->getId()); CPPUNIT_ASSERT(BtExtendedMessage::ID == m->getId());
try { try {
// disable extended messaging // disable extended messaging
peer_->setExtendedMessagingEnabled(false); peer_->setExtendedMessagingEnabled(false);
factory_->createBtMessage((const unsigned char*)msg+4, sizeof(msg)); factory_->createBtMessage((const unsigned char*)msg+4, sizeof(msg)-4);
CPPUNIT_FAIL("exception must be thrown."); CPPUNIT_FAIL("exception must be thrown.");
} catch(Exception& e) { } catch(Exception& e) {
std::cerr << e.stackTrace() << std::endl; std::cerr << e.stackTrace() << std::endl;