summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOwen Mooney <owenmooney@fb.com>2018-07-24 23:50:49 -0700
committerOwen Mooney <owenmooney@fb.com>2018-07-24 23:50:49 -0700
commitc528a468bd226ac63e45bb4dfb610474fb78b51f (patch)
treea3c5bfdfa218bd09c6b29ea202c9b1aca62b6e99
parent6075381c81b9da7afdc55b2577cd999191cb8a73 (diff)
.
-rw-r--r--dhcpv4/option_bootfile_name.go10
1 files 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
}