BUG/MINOR: ssl: Missing goto in error path in ocsp update code

When converting an OCSP request's information into base64, the return
value of a2base64 is checked but processing is not interrupted when it
returns a negative value, which was caught by coverity.

This patch fixes GitHub issue #1974.
It does not need to be backported.
This commit is contained in:
Remi Tricot-Le Breton 2023-01-02 15:01:16 +01:00 committed by Willy Tarreau
parent c57fb3be75
commit c389b04bc5

View File

@ -640,8 +640,6 @@ int ssl_ocsp_create_request_details(const OCSP_CERTID *certid, struct buffer *re
goto end; goto end;
} }
errcode = 0;
/* HTTP based OCSP requests can use either the GET or the POST method to /* HTTP based OCSP requests can use either the GET or the POST method to
* submit their requests. To enable HTTP caching, small requests (that * submit their requests. To enable HTTP caching, small requests (that
* after encoding are less than 255 bytes), MAY be submitted using GET. * after encoding are less than 255 bytes), MAY be submitted using GET.
@ -660,6 +658,7 @@ int ssl_ocsp_create_request_details(const OCSP_CERTID *certid, struct buffer *re
if (base64_ret < 0) { if (base64_ret < 0) {
memprintf(err, "%sa2base64() error\n", *err ? *err : ""); memprintf(err, "%sa2base64() error\n", *err ? *err : "");
goto end;
} }
b64buf->data = base64_ret; b64buf->data = base64_ret;
@ -668,12 +667,15 @@ int ssl_ocsp_create_request_details(const OCSP_CERTID *certid, struct buffer *re
query_encode_map, b64buf); query_encode_map, b64buf);
if (ret && *ret == '\0') { if (ret && *ret == '\0') {
req_url->data = ret - b_orig(req_url); req_url->data = ret - b_orig(req_url);
errcode = 0;
} }
} }
else { else {
chunk_cpy(req_body, bin_request); chunk_cpy(req_body, bin_request);
errcode = 0;
} }
end: end:
OCSP_REQUEST_free(ocsp); OCSP_REQUEST_free(ocsp);