mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
fix warning
This commit is contained in:
parent
801c4a15e1
commit
669644ce1b
1 changed files with 8 additions and 4 deletions
|
@ -24,22 +24,26 @@
|
||||||
// get a ATR description based on the atr bytes
|
// get a ATR description based on the atr bytes
|
||||||
// returns description of the best match
|
// returns description of the best match
|
||||||
const char *getAtrInfo(const char *atr_str) {
|
const char *getAtrInfo(const char *atr_str) {
|
||||||
|
|
||||||
size_t slen = strlen(atr_str);
|
size_t slen = strlen(atr_str);
|
||||||
int match = -1;
|
int match = -1;
|
||||||
// skip last element of AtrTable
|
|
||||||
for (int i = 0; i < ARRAYLEN(AtrTable) - 1; ++i) {
|
|
||||||
|
|
||||||
if (strlen(AtrTable[i].bytes) != slen)
|
// skip last element of AtrTable
|
||||||
|
for (size_t i = 0; i < ARRAYLEN(AtrTable) - 1; ++i) {
|
||||||
|
|
||||||
|
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");
|
||||||
return NULL;
|
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];
|
tmp_atr[j] = (AtrTable[i].bytes[j] == '.') ? '.' : atr_str[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue