From f2b941394b99ef6d9ebdbefba3eac9cc17695c70 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 26 Apr 2019 19:51:00 +0930 Subject: [PATCH] protocol/rtsp: fixed read response bug --- protocol/rtsp/rtsp.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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)