From 7617134a9ac16b71abaac98f865ce602b3507b34 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Fri, 25 Feb 2022 16:38:07 -0500 Subject: [PATCH] crypto: fix return type prob reportec by coverity Coverity correctly reported that the value returned by BIO_get_mem_data could be negative and the type provided for the return value was unsigned. Fix up the type and check. Signed-off-by: Michael Dawson --- src/crypto/crypto_common.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc index dce0774e8fa632..6398eba756b3b7 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc @@ -767,9 +767,9 @@ static bool PrintGeneralName(const BIOPointer& out, const GENERAL_NAME* gen) { return false; } char* oline = nullptr; - size_t n_bytes = BIO_get_mem_data(tmp.get(), &oline); - CHECK_IMPLIES(n_bytes != 0, oline != nullptr); - PrintAltName(out, oline, n_bytes, true, nullptr); + long n_bytes = BIO_get_mem_data(tmp.get(), &oline); + CHECK_IMPLIES(n_bytes > 0, oline != nullptr); + PrintAltName(out, oline, (size_t)n_bytes, true, nullptr); } else if (gen->type == GEN_IPADD) { BIO_printf(out.get(), "IP Address:"); const ASN1_OCTET_STRING* ip = gen->d.ip;