From 9d355a9b4e45ca3e69a53b28125c39f9fff7473d Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 27 May 2020 22:36:14 +0200 Subject: [PATCH] fix out-of-bound --- client/src/cmdhf15.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 67e47c0d4..9c6c343aa 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -263,7 +263,6 @@ static int nxp_15693_print_signature(uint8_t *uid, uint8_t *signature) { */ uint8_t i; - int res; bool is_valid = false; for (i = 0; i < ARRAYLEN(nxp_15693_public_keys); i++) { @@ -271,14 +270,14 @@ static int nxp_15693_print_signature(uint8_t *uid, uint8_t *signature) { uint8_t key[PUBLIC_ECDA_KEYLEN]; param_gethex_to_eol(nxp_15693_public_keys[i].value, 0, key, PUBLIC_ECDA_KEYLEN, &dl); - res = ecdsa_signature_r_s_verify(MBEDTLS_ECP_DP_SECP128R1, key, uid, 8, signature, 32, false); + int res = ecdsa_signature_r_s_verify(MBEDTLS_ECP_DP_SECP128R1, key, uid, 8, signature, 32, false); is_valid = (res == 0); if (is_valid) break; } PrintAndLogEx(NORMAL, ""); - if (is_valid == false) { + if (is_valid == false || i == ARRAYLEN(nxp_15693_public_keys)) { PrintAndLogEx(SUCCESS, "Signature verification " _RED_("failed")); return PM3_ESOFT; }