diff --git a/protocol/rtsp/rtsp.go b/protocol/rtsp/rtsp.go index 605057ff..eba7f20f 100644 --- a/protocol/rtsp/rtsp.go +++ b/protocol/rtsp/rtsp.go @@ -141,12 +141,18 @@ func ReadResponse(r io.Reader) (*Response, error) { } var proto string - fmt.Sscanf(s, "%s %d %s", &proto, &resp.StatusCode, &resp.Status) + _, err = fmt.Sscanf(s, "%s %d %s", &proto, &resp.StatusCode, &resp.Status) + if err != nil { + return nil, err + } s1 := strings.Split(proto, "/") resp.Proto = s1[0] - fmt.Sscanf(s1[1], "%d.%d", &resp.ProtoMajor, &resp.ProtoMinor) + _, err = fmt.Sscanf(s1[1], "%d.%d", &resp.ProtoMajor, &resp.ProtoMinor) + if err != nil { + return nil, err + } // Read headers. for {