From 1d66525b8e3e4d7f39bd1121cb34b0a6526be361 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 6 Jul 2022 12:14:54 +0200 Subject: [PATCH] fix cid 395631 - making a local copy instead of object --- client/src/cipurse/cipursecore.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/cipurse/cipursecore.c b/client/src/cipurse/cipursecore.c index 76b9d9b8d..abe8a6bc2 100644 --- a/client/src/cipurse/cipursecore.c +++ b/client/src/cipurse/cipursecore.c @@ -412,10 +412,14 @@ void CIPURSEPrintDGI(uint8_t *dgi, size_t dgilen) { } for (int i = 0; i < len / 20; i++) { - PrintAndLogEx(INFO, "Key[%d]............ %s", i + 1, sprint_hex_inrow(&dgi[3 + i * 20 + 0], 16)); - PrintAndLogEx(INFO, " Additional info.. 0x%02x", dgi[3 + i * 20 + 16]); + uint8_t kvv[CIPURSE_KVV_LENGTH] = {0}; - CipurseCGetKVV(&dgi[3 + i * 20 + 0], kvv); + uint8_t aeskey[16] = {0}; + memcpy(aeskey, &dgi[3 + i * 20 + 0], sizeof(aeskey)); + + PrintAndLogEx(INFO, "Key[%d]............ %s", i + 1, sprint_hex_inrow(aeskey, sizeof(aeskey))); + PrintAndLogEx(INFO, " Additional info.. 0x%02x", dgi[3 + i * 20 + 16]); + CipurseCGetKVV(aeskey, kvv); bool kvvvalid = (memcmp(kvv, &dgi[3 + i * 20 + 17], 3) == 0); PrintAndLogEx(INFO, " KVV.............. %s (%s)", sprint_hex_inrow(&dgi[3 + i * 20 + 17], 3), (kvvvalid) ? _GREEN_("valid") : _RED_("invalid")); }