diff --git a/protocol/rtsp/rtsp.go b/protocol/rtsp/rtsp.go index cd86f154..d88a3206 100644 --- a/protocol/rtsp/rtsp.go +++ b/protocol/rtsp/rtsp.go @@ -166,15 +166,15 @@ func ReadResponse(r io.Reader) (*Response, error) { return nil, err } + if len(s) < minResponse { + return nil, errSmallResponse + } + // Check that it was terminated by CRLF. if []byte(s)[len(s)-2] != '\r' { return nil, errors.New("line not terminated by CRLF") } - if len(s) < minResponse { - return nil, errSmallResponse - } - // Split first line. s1 := strings.SplitN(s, " ", 3)