Fix ATS lenght in pn53x_decode_target_data().
This commit is contained in:
parent
8c1815fbea
commit
cf0c2dd9f2
1 changed files with 3 additions and 2 deletions
|
@ -243,7 +243,8 @@ pn53x_decode_target_data(const byte_t* pbtRawData, size_t szDataLen, nfc_chip_t
|
||||||
switch(ntt) {
|
switch(ntt) {
|
||||||
case NTT_MIFARE:
|
case NTT_MIFARE:
|
||||||
case NTT_GENERIC_PASSIVE_106:
|
case NTT_GENERIC_PASSIVE_106:
|
||||||
// We skip target number (Tg)
|
// We skip the first byte: its the target number (Tg)
|
||||||
|
|
||||||
pbtRawData++;
|
pbtRawData++;
|
||||||
// Somehow they switched the lower and upper ATQA bytes around for the PN531 chipset
|
// Somehow they switched the lower and upper ATQA bytes around for the PN531 chipset
|
||||||
if (nc == NC_PN531) {
|
if (nc == NC_PN531) {
|
||||||
|
@ -261,7 +262,7 @@ pn53x_decode_target_data(const byte_t* pbtRawData, size_t szDataLen, nfc_chip_t
|
||||||
|
|
||||||
// Did we received an optional ATS (Smardcard ATR)
|
// Did we received an optional ATS (Smardcard ATR)
|
||||||
if (szDataLen > (pnti->nai.szUidLen + 5)) {
|
if (szDataLen > (pnti->nai.szUidLen + 5)) {
|
||||||
pnti->nai.szAtsLen = *(pbtRawData++);
|
pnti->nai.szAtsLen = ((*(pbtRawData++)) - 1); // In pbtRawData, ATS Length byte is counted in ATS Frame.
|
||||||
memcpy(pnti->nai.abtAts, pbtRawData, pnti->nai.szAtsLen);
|
memcpy(pnti->nai.abtAts, pbtRawData, pnti->nai.szAtsLen);
|
||||||
} else {
|
} else {
|
||||||
pnti->nai.szAtsLen = 0;
|
pnti->nai.szAtsLen = 0;
|
||||||
|
|
Loading…
Reference in a new issue