don't accept DHT posts with time in far-future.

(timeline still need to be fixed though)
This commit is contained in:
Miguel Freitas 2014-09-21 11:10:59 -03:00
parent 00b67caea4
commit a7e9b67e37
2 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -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();