Fix possible buffer overread in psa_mac_finish_internal (CMAC)
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 0aa19cf..410f648 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1738,7 +1738,7 @@
uint8_t tmp[PSA_MAX_BLOCK_CIPHER_BLOCK_SIZE];
int ret = mbedtls_cipher_cmac_finish( &operation->ctx.cmac, tmp );
if( ret == 0 )
- memcpy( mac, tmp, mac_size );
+ memcpy( mac, tmp, operation->mac_size );
mbedtls_zeroize( tmp, sizeof( tmp ) );
return( mbedtls_to_psa_error( ret ) );
}