From 67daaa2560b97b53499cdfa5aa577c438b1e01ff Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 20 Apr 2021 01:23:01 -0400 Subject: [PATCH] Clear Clang finding in CMAC --- cmac.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmac.cpp b/cmac.cpp index 7a71236f..3ff57f1e 100644 --- a/cmac.cpp +++ b/cmac.cpp @@ -151,7 +151,9 @@ void CMAC_Base::TruncatedFinal(byte *mac, size_t size) else cipher.AdvancedProcessBlocks(m_reg, m_reg+blockSize, m_reg, blockSize, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput); - memcpy(mac, m_reg, size); + // UBsan finding + if (mac) + memcpy(mac, m_reg, size); m_counter = 0; memset(m_reg, 0, blockSize);