]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Validate the category in OSSL_trace_end()
authorMatt Caswell <matt@openssl.org>
Wed, 29 Dec 2021 13:42:58 +0000 (13:42 +0000)
committerPauli <pauli@openssl.org>
Tue, 4 Jan 2022 00:09:03 +0000 (11:09 +1100)
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)

crypto/trace.c

index f012b617abc68f53e2e052d62307f9420ac6c4e4..cc0b4776986efebe2f6809ff0fe83c6832103213 100644 (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)) {