From cc82aadcc58713a14d22570b3b577e059121f71e Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Fri, 8 Sep 2023 11:59:30 -0600 Subject: [PATCH] Error on unknown content size: Signed-off-by: Jacob Weinstock --- providers/rpc/rpc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/rpc/rpc.go b/providers/rpc/rpc.go index aa7f679b..05c799c2 100644 --- a/providers/rpc/rpc.go +++ b/providers/rpc/rpc.go @@ -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) } respPayload, err := p.handleResponse(resp, kvs)