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:
Leon Hwang
2024-11-26 20:26:41 +08:00
committed by Alessandro Boch
parent 62fb240731
commit 655392bc77

View File

@@ -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])