From 625b22a8d7bece655216b926f1b4ce35e14ccb07 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Fri, 23 Aug 2019 14:44:23 +0300 Subject: [PATCH] * dhcp: validate range_start/range_end values --- dhcpd/dhcpd.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dhcpd/dhcpd.go b/dhcpd/dhcpd.go index 3d3d0b33..a1a54b2e 100644 --- a/dhcpd/dhcpd.go +++ b/dhcpd/dhcpd.go @@ -129,6 +129,9 @@ func (s *Server) setConfig(config ServerConfig) error { if err != nil { return wrapErrPrint(err, "Failed to parse range end address %s", config.RangeEnd) } + if dhcp4.IPRange(s.leaseStart, s.leaseStop) <= 0 { + return wrapErrPrint(err, "DHCP: Incorrect range_start/range_end values") + } subnet, err := parseIPv4(config.SubnetMask) if err != nil || !isValidSubnetMask(subnet) {