Continue reading incoming data until enough rcvd
This fixes the case of a large packet being received, the current code stops processing as soon as >12 bytes are received,
This commit is contained in:
parent
57337a6004
commit
885609309c
@ -91,6 +91,10 @@ func decodeInPack(data []byte) (inpack *inPack, l int, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dl := int(binary.BigEndian.Uint32(data[8:12]))
|
dl := int(binary.BigEndian.Uint32(data[8:12]))
|
||||||
|
if len(data) < (dl + minPacketLength) {
|
||||||
|
err = fmt.Errorf("Not enough data: %V", data)
|
||||||
|
return
|
||||||
|
}
|
||||||
dt := data[minPacketLength : dl+minPacketLength]
|
dt := data[minPacketLength : dl+minPacketLength]
|
||||||
if len(dt) != int(dl) { // length not equal
|
if len(dt) != int(dl) { // length not equal
|
||||||
err = fmt.Errorf("Invalid data: %V", data)
|
err = fmt.Errorf("Invalid data: %V", data)
|
||||||
|
Loading…
Reference in New Issue
Block a user