mirror of
https://github.com/vishvananda/netlink.git
synced 2025-09-26 20:01:13 +08:00
Fix parsing 4-bytes attribute
What if the data length of attribute is 4? The attribute will be ignored, because `i+4 < len(data)`. Signed-off-by: Leon Hwang <hffilwlqm@gmail.com>
This commit is contained in:

committed by
Alessandro Boch

parent
62fb240731
commit
655392bc77
@@ -17,7 +17,7 @@ func ParseAttributes(data []byte) <-chan Attribute {
|
||||
|
||||
go func() {
|
||||
i := 0
|
||||
for i+4 < len(data) {
|
||||
for i+4 <= len(data) {
|
||||
length := int(native.Uint16(data[i : i+2]))
|
||||
attrType := native.Uint16(data[i+2 : i+4])
|
||||
|
||||
|
Reference in New Issue
Block a user