Check for NodeID length

This commit is contained in:
Julian Kornberger 2016-03-20 17:16:49 +01:00
parent 808135904f
commit 53720c3c57
1 changed files with 5 additions and 2 deletions

View File

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