Skip to content

Commit

Permalink
Fix createError cap out of range
Browse files Browse the repository at this point in the history
(http.Response).ContentLength can have value -1 which causes cap out of range panic

Fixes #72
  • Loading branch information
AtakanColak committed Mar 2, 2022
1 parent 8edc580 commit 91d132d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion schemaRegistryClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ func (e Error) Error() string {
}

func createError(resp *http.Response) error {
err := Error{str: bytes.NewBuffer(make([]byte, 0, resp.ContentLength))}
err := Error{str: bytes.NewBuffer(make([]byte, 0))}
decoder := json.NewDecoder(io.TeeReader(resp.Body, err.str))
marshalErr := decoder.Decode(&err)
if marshalErr != nil {
Expand Down

0 comments on commit 91d132d

Please sign in to comment.