diff --git a/libtorrent/src/kademlia/dht_get.cpp b/libtorrent/src/kademlia/dht_get.cpp index 77892de5..26f4bc09 100644 --- a/libtorrent/src/kademlia/dht_get.cpp +++ b/libtorrent/src/kademlia/dht_get.cpp @@ -121,6 +121,14 @@ void dht_get_observer::reply(msg const& m) #endif continue; } + + int64 p_time = p->dict_find_int_value("time"); + if(!p_time || p_time > GetAdjustedTime() + 2*60*60 ) { +#ifdef TORRENT_DHT_VERBOSE_LOGGING + TORRENT_LOG(traversal) << "dht_get_observer::reply invalid time"; +#endif + continue; + } values_list.push_back(entry()); values_list.back() = *e; diff --git a/libtorrent/src/kademlia/node.cpp b/libtorrent/src/kademlia/node.cpp index db08fd66..f5736335 100644 --- a/libtorrent/src/kademlia/node.cpp +++ b/libtorrent/src/kademlia/node.cpp @@ -1430,6 +1430,11 @@ void node_impl::incoming_request(msg const& m, entry& e) return; } + if (msg_keys[mk_time]->int_value() > GetAdjustedTime() + 2*60*60) { + incoming_error(e, "time > GetAdjustedTime"); + return; + } + m_table.node_seen(id, m.addr, 0xffff); //f->last_seen = time_now();