route: remove check for unparsed route message bytes

Under some circumstances, DragonFly BSD appears to put more addresses
in route messages than are indicated in the message header. Remove
the recently-added check for unparsed bytes in a route message to
avoid errors.

Change-Id: Id567e4cd49470970f78dbd2decd682c4c00b27fa
Reviewed-on: https://go-review.googlesource.com/c/net/+/322429
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Damien Neil
2021-05-24 17:50:19 -07:00
parent fe42d452be
commit abc453219e

View File

@@ -422,11 +422,9 @@ func parseAddrs(attrs uint, fn func(int, []byte) (int, Addr, error), b []byte) (
b = b[l:]
}
}
if len(b) > 4 {
// If there is more data left over after parsing all addresses
// than might be needed for alignment, then we have made a mistake
// somewhere.
return nil, errInvalidMessage
}
// The only remaining bytes in b should be alignment.
// However, under some circumstances DragonFly BSD appears to put
// more addresses in the message than are indicated in the address
// bitmask, so don't check for this.
return as[:], nil
}