mirror of https://bitbucket.org/ausocean/av.git
protocol/rtsp: only giving Sscanf s[5:] and then checking number of decimals read as well as error
This commit is contained in:
parent
77e5d234de
commit
66bc6bbe33
|
@ -137,9 +137,9 @@ func ReadResponse(r io.Reader) (*Response, error) {
|
||||||
}
|
}
|
||||||
resp.Proto = "RTSP"
|
resp.Proto = "RTSP"
|
||||||
|
|
||||||
_, err = fmt.Sscanf(s[5:12], "%d.%d %d", &resp.ProtoMajor, &resp.ProtoMinor, &resp.StatusCode)
|
n, err := fmt.Sscanf(s[5:], "%d.%d %d", &resp.ProtoMajor, &resp.ProtoMinor, &resp.StatusCode)
|
||||||
if err != nil {
|
if err != nil || n != 3 {
|
||||||
return nil, err
|
return nil, fmt.Errorf("could not Sscanf response, error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read headers.
|
// Read headers.
|
||||||
|
|
Loading…
Reference in New Issue