From 669644ce1b69dbe4378efaa1fe4519a65f168320 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 15 Nov 2024 17:46:35 +0100 Subject: [PATCH] fix warning --- client/src/atrs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/atrs.c b/client/src/atrs.c index d8f11587f..e851cf8f9 100644 --- a/client/src/atrs.c +++ b/client/src/atrs.c @@ -24,22 +24,26 @@ // get a ATR description based on the atr bytes // returns description of the best match const char *getAtrInfo(const char *atr_str) { + size_t slen = strlen(atr_str); int match = -1; + // skip last element of AtrTable - for (int i = 0; i < ARRAYLEN(AtrTable) - 1; ++i) { + for (size_t i = 0; i < ARRAYLEN(AtrTable) - 1; ++i) { - if (strlen(AtrTable[i].bytes) != slen) + if (strlen(AtrTable[i].bytes) != slen) { continue; + } if (strstr(AtrTable[i].bytes, ".") != NULL) { + char *tmp_atr = calloc(slen, sizeof(uint8_t)); if (tmp_atr == NULL) { PrintAndLogEx(FAILED, "failed to allocate memory"); return NULL; } - for (int j = 0; j < slen; j++) { + for (size_t j = 0; j < slen; j++) { tmp_atr[j] = (AtrTable[i].bytes[j] == '.') ? '.' : atr_str[j]; } -- 2.11.4.GIT