Don't perform any further checks on too short IP numbers (fixes #764)

This commit is contained in:
Jakob Borg 2014-09-30 17:23:31 +02:00
parent 3059b36118
commit 3eb000fa60

View File

@ -51,7 +51,7 @@ func (b *Broadcast) writer() {
var dsts []net.IP
for _, addr := range addrs {
if iaddr, ok := addr.(*net.IPNet); ok && iaddr.IP.IsGlobalUnicast() && iaddr.IP.To4() != nil {
if iaddr, ok := addr.(*net.IPNet); ok && len(iaddr.IP) >= 4 && iaddr.IP.IsGlobalUnicast() && iaddr.IP.To4() != nil {
baddr := bcast(iaddr)
dsts = append(dsts, baddr.IP)
}