dht: Some peer sent me a bad info_hash

This commit is contained in:
Matt Joiner 2014-12-20 10:10:53 +11:00
parent ec47c4f4dc
commit dbf72c1033
1 changed files with 3 additions and 0 deletions

View File

@ -475,6 +475,9 @@ func (s *Server) handleQuery(source dHTAddr, m Msg) {
s.reply(source, m["t"].(string), nil)
case "get_peers":
targetID := args["info_hash"].(string)
if len(targetID) != 20 {
break
}
var rNodes []NodeInfo
// TODO: Reply with "values" list if we have peers instead.
for _, node := range s.closestGoodNodes(8, targetID) {