diff --git a/protocol/rtsp/rtsp.go b/protocol/rtsp/rtsp.go index 22d84236..fb9130bc 100644 --- a/protocol/rtsp/rtsp.go +++ b/protocol/rtsp/rtsp.go @@ -132,8 +132,12 @@ func ReadResponse(r io.Reader) (*Response, error) { } s := scanner.Text() - if s[:5] != "RTSP/" || len(s) < minResponse { - return nil, errors.New("response not valid") + if len(s) < minResponse { + return nil, errors.New("response length too small") + } + + if s[:5] != "RTSP/" { + return nil, errors.New("invalid response") } resp.Proto = "RTSP"