summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv4')
-rw-r--r--dhcpv4/option_ip_address_lease_time.go2
-rw-r--r--dhcpv4/option_ip_address_lease_time_test.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/dhcpv4/option_ip_address_lease_time.go b/dhcpv4/option_ip_address_lease_time.go
index a171b04..7562c58 100644
--- a/dhcpv4/option_ip_address_lease_time.go
+++ b/dhcpv4/option_ip_address_lease_time.go
@@ -17,7 +17,7 @@ type OptIPAddressLeaseTime struct {
// sequence of bytes and returns it, or an error.
func ParseOptIPAddressLeaseTime(data []byte) (*OptIPAddressLeaseTime, error) {
// Should at least have code, length, and lease time.
- if len(data) < 4 {
+ if len(data) < 6 {
return nil, ErrShortByteStream
}
code := OptionCode(data[0])
diff --git a/dhcpv4/option_ip_address_lease_time_test.go b/dhcpv4/option_ip_address_lease_time_test.go
index 66715bd..7d507bf 100644
--- a/dhcpv4/option_ip_address_lease_time_test.go
+++ b/dhcpv4/option_ip_address_lease_time_test.go
@@ -20,7 +20,7 @@ func TestParseOptIPAddressLeaseTime(t *testing.T) {
require.Equal(t, &OptIPAddressLeaseTime{LeaseTime: 43200}, o)
// Short byte stream
- data = []byte{51, 4}
+ data = []byte{51, 4, 168, 192}
_, err = ParseOptIPAddressLeaseTime(data)
require.Error(t, err, "should get error from short byte stream")