Browse Source

changes from code review

cl-refactor
subtly 10 years ago
parent
commit
80edf61630
  1. 2
      libp2p/Host.h
  2. 4
      libp2p/Session.cpp

2
libp2p/Host.h

@ -50,7 +50,7 @@ namespace dev
namespace p2p namespace p2p
{ {
class Host; class Host;
class HostNodeTableHandler: public NodeTableEventHandler class HostNodeTableHandler: public NodeTableEventHandler

4
libp2p/Session.cpp

@ -403,7 +403,7 @@ void Session::doRead()
// ignore packets received while waiting to disconnect. // ignore packets received while waiting to disconnect.
if (m_dropped) if (m_dropped)
return; return;
auto self(shared_from_this()); auto self(shared_from_this());
ba::async_read(m_socket, boost::asio::buffer(m_data, h256::size), [this,self](boost::system::error_code ec, std::size_t length) ba::async_read(m_socket, boost::asio::buffer(m_data, h256::size), [this,self](boost::system::error_code ec, std::size_t length)
{ {
@ -427,7 +427,7 @@ void Session::doRead()
/// check frame size /// check frame size
uint32_t frameSize = (m_data[0] * 256 + m_data[1]) * 256 + m_data[2]; uint32_t frameSize = (m_data[0] * 256 + m_data[1]) * 256 + m_data[2];
if (frameSize > 16777216) if (frameSize >= (uint32_t)1 << 24)
{ {
clog(NetWarn) << "frame size too large"; clog(NetWarn) << "frame size too large";
drop(BadProtocol); drop(BadProtocol);

Loading…
Cancel
Save