Skip to content

Commit 5693c58

Browse files
ivgfujita
authored andcommitted
pkg/packet/rtr: fix parser to check the input length
1 parent 5153baf commit 5693c58

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: pkg/packet/rtr/rtr.go

+3
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,9 @@ func SplitRTR(data []byte, atEOF bool) (advance int, token []byte, err error) {
364364
}
365365

366366
func ParseRTR(data []byte) (RTRMessage, error) {
367+
if len(data) < 1 {
368+
return nil, fmt.Errorf("not all bytes are available for RTR message")
369+
}
367370
var msg RTRMessage
368371
switch data[1] {
369372
case RTR_SERIAL_NOTIFY:

0 commit comments

Comments
 (0)