]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix coverity 1516093 tainted scalar
authorTodd Short <tshort@akamai.com>
Thu, 27 Oct 2022 14:27:29 +0000 (10:27 -0400)
committerTomas Mraz <tomas@openssl.org>
Wed, 2 Nov 2022 10:35:52 +0000 (11:35 +0100)
|uclen| is created from three byte values, so this seems a bit
redundant, but if it makes coverity happy

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19519)

ssl/t1_trce.c

index 4725185e79d0f40d862690ba00ab9e8bad56534c..6d314c5331fa93f73accbac9b87bc35f24618262 100644 (file)
@@ -1345,7 +1345,8 @@ static int ssl_print_compressed_certificates(BIO *bio, const SSL_CONNECTION *sc,
     if (!ossl_comp_has_alg(alg))
         return 0;
 
-    if (uclen == 0 || (ucdata = OPENSSL_malloc(uclen)) == NULL)
+    /* Check against certificate maximum size (coverity) */
+    if (uclen == 0 || uclen > 0xFFFFFF || (ucdata = OPENSSL_malloc(uclen)) == NULL)
         return 0;
 
     switch (alg) {