When X509_NAME_oneline() is called without a buffer, it allocates one
which was never free'd in the SSL traces' code. Rather than free it, we
might as well use a trash to avoid an allocation.
This was introduced in 3.2 by commit
4a8fa28e3 ("MINOR: ssl: Add traces
around SSL_do_handshake call"). It must be backported to 3.2.
Reported-by: Claude (ANT-2026-4P18WC9H)
if (crt) {
__X509_NAME_CONST__ X509_NAME *name = X509_get_subject_name(crt);
- if (name)
+ if (name) {
+ chunk_reset(&trash);
chunk_appendf(&trace_buf, " subject=\"%s\"",
- X509_NAME_oneline(name, 0, 0));
+ X509_NAME_oneline(name, b_orig(&trash), b_size(&trash)));
+ }
}
}
}