mirror of https://bitbucket.org/ausocean/av.git
protocol/rtsp: in ReadResponse response length check comes before protocol check
This commit is contained in:
parent
ba7e768269
commit
eac5652f1b
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue