too few data to unpack, read more
This commit is contained in:
parent
63480d6547
commit
027ca1c67c
@ -137,11 +137,14 @@ BEGIN:
|
|||||||
}
|
}
|
||||||
// split package
|
// split package
|
||||||
tl := len(data)
|
tl := len(data)
|
||||||
if tl < 12 {
|
if tl < 12 { // too few data to unpack, read more
|
||||||
goto BEGIN
|
goto BEGIN
|
||||||
}
|
}
|
||||||
start := 0
|
start := 0
|
||||||
for i := 0; i < tl; i++ {
|
for i := 0; i < tl - 12; i++ {
|
||||||
|
if start + 12 > tl { // too few data to unpack, read more
|
||||||
|
goto BEGIN
|
||||||
|
}
|
||||||
if string(data[start:start+4]) == common.RES_STR {
|
if string(data[start:start+4]) == common.RES_STR {
|
||||||
l := int(common.BytesToUint32([4]byte{data[start+8],
|
l := int(common.BytesToUint32([4]byte{data[start+8],
|
||||||
data[start+9], data[start+10], data[start+11]}))
|
data[start+9], data[start+10], data[start+11]}))
|
||||||
@ -155,10 +158,11 @@ BEGIN:
|
|||||||
} else { // ops! It won't be possible.
|
} else { // ops! It won't be possible.
|
||||||
goto BEGIN
|
goto BEGIN
|
||||||
}
|
}
|
||||||
} else {
|
} else { // flag was not found, move to next step
|
||||||
start++
|
start++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
goto BEGIN
|
||||||
return nil, common.Errorf("Invalid data: %V", data)
|
return nil, common.Errorf("Invalid data: %V", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user