From c528a468bd226ac63e45bb4dfb610474fb78b51f Mon Sep 17 00:00:00 2001 From: Owen Mooney Date: Tue, 24 Jul 2018 23:50:49 -0700 Subject: . --- dhcpv4/option_bootfile_name.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dhcpv4/option_bootfile_name.go b/dhcpv4/option_bootfile_name.go index d7b291b..73ea625 100644 --- a/dhcpv4/option_bootfile_name.go +++ b/dhcpv4/option_bootfile_name.go @@ -39,16 +39,16 @@ func ParseOptBootfileName(data []byte) (*OptBootfileName, error) { } code := OptionCode(data[0]) if code != OptionBootfileName { - return nil, fmt.Errorf("expected code %v, got %v", OptionBootfileName, code) + return nil, fmt.Errorf("ParseOptBootfileName: invalid code: %v; want %v", code, OptionBootfileName) } length := int(data[1]) if length < 1 { return nil, fmt.Errorf("Bootfile name has invalid length of %d", length) } - data = data[2:] - if len(data) < length { + bootFileNameData := data[2:] + if len(bootFileNameData) < length { return nil, fmt.Errorf("ParseOptBootfileName: short data: %d bytes; want %d", - len(data), length) + len(bootFileNameData), length) } - return &OptBootfileName{BootfileName: data[:length]}, nil + return &OptBootfileName{BootfileName: bootFileNameData[:length]}, nil } -- cgit v1.2.3