summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/option_routes.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv4/option_routes.go')
-rw-r--r--dhcpv4/option_routes.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/dhcpv4/option_routes.go b/dhcpv4/option_routes.go
index 603273a..c98d481 100644
--- a/dhcpv4/option_routes.go
+++ b/dhcpv4/option_routes.go
@@ -38,6 +38,9 @@ func (r Route) Marshal(buf *uio.Lexer) {
// Unmarshal implements uio.Unmarshaler.
func (r *Route) Unmarshal(buf *uio.Lexer) error {
maskSize := buf.Read8()
+ if maskSize > 32 {
+ return fmt.Errorf("invalid mask length %d in route option", maskSize)
+ }
r.Dest = &net.IPNet{
IP: make([]byte, net.IPv4len),
Mask: net.CIDRMask(int(maskSize), 32),