Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Dawson <mdawson@devrus.com>2022-02-26 00:38:07 +0300
committerMichael Dawson <mdawson@devrus.com>2022-03-01 17:05:29 +0300
commita9c0689786591dc45d319d9e3ae8d42e1b4594a7 (patch)
treecacecf5d5e7f5ed555a0809a96176ec1a7ba3838 /src
parent3ba41246d24b73d505b51fe1a04c328e977a1bee (diff)
crypto: fix return type prob reported 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 <mdawson@devrus.com> PR-URL: https://github.com/nodejs/node/pull/42135 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/crypto/crypto_common.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc
index 3ec1152adc0..1e0fa4f0661 100644
--- a/src/crypto/crypto_common.cc
+++ b/src/crypto/crypto_common.cc
@@ -741,9 +741,10 @@ 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);
+ long n_bytes = BIO_get_mem_data(tmp.get(), &oline); // NOLINT(runtime/int)
+ CHECK_GE(n_bytes, 0);
CHECK_IMPLIES(n_bytes != 0, oline != nullptr);
- PrintAltName(out, oline, n_bytes, true, nullptr);
+ PrintAltName(out, oline, static_cast<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;