BUG/MINOR: ssl: append OCSP base64 newline to the output buffer
ssl_ocsp_response_print_base64() encodes the response into the output
buffer, but attempts to append the trailing newline to the stored OCSP
response instead. As a result, the base64 dump lacks its terminating
newline.
Stored responses are allocated by chunk_dup() with at most one spare
byte. Since chunk_appendf() also needs room for a terminating NUL, this
does not extend the stored response, contrary to the reported impact.
Append the newline to the output buffer instead. The separate missing
OCSP lock in the CLI detail handler is not addressed by this patch.
Verified with 100 repeated CLI dumps and TLS stapling before and after
the reads. Each dump decodes to the original OCSP response.
Reported by brhenc in GitHub issue #3593:
https://github.com/haproxy/haproxy/issues/3593
The bug was introduced in
9c4437d02 ("MINOR: ssl: Add way to dump ocsp
response in base64"), first released in 2.8.
This fix should be backported to all maintained branches since 2.8.