From 53720c3c573358e99a6e2ce6f8413335d49137f4 Mon Sep 17 00:00:00 2001 From: Julian Kornberger Date: Sun, 20 Mar 2016 17:16:49 +0100 Subject: [PATCH] Check for NodeID length --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 8170752..07d2562 100644 --- a/main.go +++ b/main.go @@ -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) }