thanks @DidierA for the sharp eyes

This commit is contained in:
iceman1001 2023-08-02 19:49:26 +02:00
commit 1c35f14c76

View file

@ -32,7 +32,7 @@ const char *getAtrInfo(const char *atr_str) {
if (strlen(AtrTable[i].bytes) != slen) if (strlen(AtrTable[i].bytes) != slen)
continue; continue;
if (strstr(AtrTable[i].bytes, "..") != NULL) { if (strstr(AtrTable[i].bytes, ".") != NULL) {
char *tmp_atr = calloc(slen, sizeof(uint8_t)); char *tmp_atr = calloc(slen, sizeof(uint8_t));
if (tmp_atr == NULL) { if (tmp_atr == NULL) {
PrintAndLogEx(FAILED, "failed to allocate memory"); PrintAndLogEx(FAILED, "failed to allocate memory");
@ -40,7 +40,7 @@ const char *getAtrInfo(const char *atr_str) {
} }
for (int j = 0; j < slen; j++) { for (int j = 0; j < slen; j++) {
tmp_atr[j] = AtrTable[i].bytes[j] == '.' ? '.' : atr_str[j]; tmp_atr[j] = (AtrTable[i].bytes[j] == '.') ? '.' : atr_str[j];
} }
if (strncmp(tmp_atr, AtrTable[i].bytes, slen) == 0) { if (strncmp(tmp_atr, AtrTable[i].bytes, slen) == 0) {
@ -50,9 +50,12 @@ const char *getAtrInfo(const char *atr_str) {
free(tmp_atr); free(tmp_atr);
} else { } else {
if (strncmp(atr_str, AtrTable[i].bytes, slen) == 0) return AtrTable[i].desc; if (strncmp(atr_str, AtrTable[i].bytes, slen) == 0) {
return AtrTable[i].desc;
} }
} }
}
if (match >= 0) { if (match >= 0) {
return AtrTable[match].desc; return AtrTable[match].desc;
} else { } else {