diff --git a/protocol/rtsp/rtsp.go b/protocol/rtsp/rtsp.go index 501ae5be..22d84236 100644 --- a/protocol/rtsp/rtsp.go +++ b/protocol/rtsp/rtsp.go @@ -137,9 +137,9 @@ func ReadResponse(r io.Reader) (*Response, error) { } resp.Proto = "RTSP" - _, err = fmt.Sscanf(s[5:12], "%d.%d %d", &resp.ProtoMajor, &resp.ProtoMinor, &resp.StatusCode) - if err != nil { - return nil, err + n, err := fmt.Sscanf(s[5:], "%d.%d %d", &resp.ProtoMajor, &resp.ProtoMinor, &resp.StatusCode) + if err != nil || n != 3 { + return nil, fmt.Errorf("could not Sscanf response, error: %v", err) } // Read headers.