From 2fb446ab2d21e4e9d6d1031330a4f25c39676141 Mon Sep 17 00:00:00 2001 From: Eduardo Arias Date: Wed, 28 Aug 2024 12:19:58 -0300 Subject: [PATCH] Address cppcheck warnings generated after addressing Sonarcloud suggestions - The following two warnings were generated after introducing the change to instantiate the DigestImpl template with the address of mbedtls_md5 or mbedtls_sha1: - warning: src/utils/sha1.h,62,error,danglingTemporaryLifetime,Using pointer that is a temporary. - warning: src/utils/sha1.h,60,style,constVariablePointer,Variable 'ret' can be declared as pointer to const - See https://github.com/owasp-modsecurity/ModSecurity/pull/3231#issuecomment-2312511500 --- src/utils/sha1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/sha1.h b/src/utils/sha1.h index 2dac3ea2..a40d7fa1 100644 --- a/src/utils/sha1.h +++ b/src/utils/sha1.h @@ -57,7 +57,7 @@ private: ConvertOp convertOp) -> auto { char digest[DigestSize]; - auto ret = digestOp(reinterpret_cast(input.c_str()), + const auto ret = (*digestOp)(reinterpret_cast(input.c_str()), input.size(), reinterpret_cast(digest)); assert(ret == 0);