Skip to content

Commit b910da3

Browse files
committed
packet/rtr: remove SplitRTR function
There is a bug to slice buffer without checking the length. It can be fixed but the function isn't used anyway. So remove it. Signed-off-by: FUJITA Tomonori <[email protected]>
1 parent f5f098d commit b910da3

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

pkg/packet/rtr/rtr.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -373,21 +373,6 @@ func NewRTRErrorReport(errCode uint16, errPDU []byte, errMsg []byte) *RTRErrorRe
373373
return pdu
374374
}
375375

376-
func SplitRTR(data []byte, atEOF bool) (advance int, token []byte, err error) {
377-
if atEOF && len(data) == 0 || len(data) < RTR_MIN_LEN {
378-
return 0, nil, nil
379-
}
380-
381-
totalLen := binary.BigEndian.Uint32(data[4:8])
382-
if totalLen < RTR_MIN_LEN {
383-
return 0, nil, fmt.Errorf("invalid length: %d", totalLen)
384-
}
385-
if len(data) < int(totalLen) {
386-
return 0, nil, nil
387-
}
388-
return int(totalLen), data[:totalLen], nil
389-
}
390-
391376
func ParseRTR(data []byte) (RTRMessage, error) {
392377
if len(data) < RTR_MIN_LEN {
393378
return nil, fmt.Errorf("not all bytes are available for RTR message")

0 commit comments

Comments
 (0)