Check for NodeID length

This commit is contained in:
Julian Kornberger 2016-03-20 17:16:49 +01:00
parent 808135904f
commit 53720c3c57

View File

@ -89,10 +89,13 @@ func onReceive(addr net.UDPAddr, res *data.ResponseData) {
} }
// Updates nodes if NodeID found // Updates nodes if NodeID found
if nodeId != "" { if len(nodeId) != 12 {
nodes.Update(nodeId, res) log.Printf("invalid NodeID '%s' from %s", nodeId, addr.String())
return
} }
nodes.Update(nodeId, res)
if val := res.Statistics; val != nil && statsDb != nil { if val := res.Statistics; val != nil && statsDb != nil {
statsDb.Add(val) statsDb.Add(val)
} }