From 6a3ca408cff0ba95b52ded4d465e7a4b03f2f135 Mon Sep 17 00:00:00 2001 From: Flavio Santes Date: Thu, 17 Nov 2016 03:43:54 -0600 Subject: [PATCH] tests/tinycrypt: Fix wrong sizeof argument in test_ccm_mode (2nd) This commit fixes an issue in the test_ccm_mode.c file: sizeof(data) is used to compute the length of the array pointed to by the 'uint8_t *data' pointer. At the same function scope, there is a variable (dlen) that already specifies the required length, so we use that variable instead of the 'sizeof' function call. This issue was not reported by Coverity, although is worth to fix it. Change-Id: I27cbf8c7000a4189a42d193f6445996d4b852aa6 Signed-off-by: Flavio Santes --- tests/crypto/test_ccm_mode/src/test_ccm_mode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/crypto/test_ccm_mode/src/test_ccm_mode.c b/tests/crypto/test_ccm_mode/src/test_ccm_mode.c index 04768b5dcbf..4163508a601 100644 --- a/tests/crypto/test_ccm_mode/src/test_ccm_mode.c +++ b/tests/crypto/test_ccm_mode/src/test_ccm_mode.c @@ -103,7 +103,7 @@ uint32_t do_test(const uint8_t *key, uint8_t *nonce, size_t nlen, if (tc_ccm_decryption_verification(decrypted, hdr, hlen, ciphertext, dlen+mlen, &c) == 0) { TC_ERROR("ccm_decrypt failed in %s.\n", __func__); - show_str("\t\tExpected", data, sizeof(data)); + show_str("\t\tExpected", data, dlen); show_str("\t\tComputed", decrypted, sizeof(decrypted)); result = TC_FAIL; goto exitTest1;