Skip to content

Commit

Permalink
pkg/packet/rtr: fix parser to check the input length
Browse files Browse the repository at this point in the history
  • Loading branch information
ivg authored and fujita committed Feb 7, 2025
1 parent 5153baf commit 5693c58
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/packet/rtr/rtr.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ func SplitRTR(data []byte, atEOF bool) (advance int, token []byte, err error) {
}

func ParseRTR(data []byte) (RTRMessage, error) {
if len(data) < 1 {
return nil, fmt.Errorf("not all bytes are available for RTR message")
}
var msg RTRMessage
switch data[1] {
case RTR_SERIAL_NOTIFY:
Expand Down

0 comments on commit 5693c58

Please sign in to comment.