Skip to content

Commit

Permalink
Error on unknown content size:
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Weinstock <[email protected]>
  • Loading branch information
jacobweinstock committed Sep 11, 2023
1 parent 45e4d38 commit cc82aad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion providers/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func (p *Provider) process(ctx context.Context, rp RequestPayload) (ResponsePayl
defer resp.Body.Close()

// handle the response
if resp.ContentLength > maxContentLenAllowed {
if resp.ContentLength > maxContentLenAllowed || resp.ContentLength < 0 {
return ResponsePayload{}, fmt.Errorf("response body is too large: %d bytes, max allowed: %d bytes", resp.ContentLength, maxContentLenAllowed)

Check warning on line 331 in providers/rpc/rpc.go

View check run for this annotation

Codecov / codecov/patch

providers/rpc/rpc.go#L331

Added line #L331 was not covered by tests
}
respPayload, err := p.handleResponse(resp, kvs)
Expand Down

0 comments on commit cc82aad

Please sign in to comment.