Validate the category in OSSL_trace_end()

OSSL_trace_end() should validate that the category it has been passed
by the caler is valid, and return immediately if not.

Fixes #17353

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17371)
This commit is contained in:
Matt Caswell 2021-12-29 13:42:58 +00:00 committed by Pauli
parent 0088ef48c3
commit ee8a61e158

View File

@ -496,6 +496,8 @@ void OSSL_trace_end(int category, BIO * channel)
char *suffix = NULL;
category = ossl_trace_get_category(category);
if (category < 0)
return;
suffix = trace_channels[category].suffix;
if (channel != NULL
&& ossl_assert(channel == current_channel)) {