Skip to content

Commit

Permalink
Merge pull request #31 from fanap-infra/fix/check-peek-size-readLFLF
Browse files Browse the repository at this point in the history
check-peek-size-readLFLF
  • Loading branch information
saeid-a authored Jan 24, 2021
2 parents a196307 + 3fec9dd commit 8308e9f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,14 @@ func (self *Client) findRTSP() (block []byte, data []byte, err error) {

// logRTP.Tracev("rtsp: findRTSP", "i", i, "b", b)

if len(peek) > 40000000 {
log.Errorv("PeekLength", "len(peek)", len(peek), "len(block)", len(block), "stat", stat)
if len(peek) > 20000000 {
log.Errorv("findRTSP PeekLength", "len(peek)", len(peek), "len(block)", len(block), "stat", stat)
err = fmt.Errorf("rtsp: Parse error")
return
// peek = peek[(len(peek) / 2):]
// stat = 0
}
if len(block) > 40000000 {
if len(block) > 20000000 {
log.Errorv("BlockLength", "len(peek)", len(peek), "len(block)", len(block), "stat", stat)
// block = block[(len(block) / 2):]
// stat = 0
Expand Down Expand Up @@ -515,7 +515,11 @@ func (self *Client) readLFLF() (block []byte, data []byte, err error) {
dollarpos = pos
}
peek = append(peek, b)

if len(peek) > 20000000 {
log.Errorv("read LFLF PeekLength", "len(peek)", len(peek), "len(block)", len(block), "stat", stat)
err = fmt.Errorf("rtsp: Parse error")
return
}
if stat == LFLF {
data = peek
return
Expand Down

0 comments on commit 8308e9f

Please sign in to comment.