mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
cident - verify rats has size and empty buffers before
This commit is contained in:
parent
5154a28ce3
commit
fd6dda5e36
1 changed files with 52 additions and 42 deletions
|
@ -2247,6 +2247,11 @@ void MifareCIdent(bool is_mfc) {
|
||||||
uint8_t *par = BigBuf_malloc(MAX_PARITY_SIZE);
|
uint8_t *par = BigBuf_malloc(MAX_PARITY_SIZE);
|
||||||
uint8_t *buf = BigBuf_malloc(PM3_CMD_DATA_SIZE);
|
uint8_t *buf = BigBuf_malloc(PM3_CMD_DATA_SIZE);
|
||||||
uint8_t *uid = BigBuf_malloc(10);
|
uint8_t *uid = BigBuf_malloc(10);
|
||||||
|
|
||||||
|
memset(par, 0x00, MAX_PARITY_SIZE);
|
||||||
|
memset(buf, 0x00, PM3_CMD_DATA_SIZE);
|
||||||
|
memset(uid, 0x00, 10);
|
||||||
|
|
||||||
uint32_t cuid = 0;
|
uint32_t cuid = 0;
|
||||||
uint8_t data[1] = {0x00};
|
uint8_t data[1] = {0x00};
|
||||||
|
|
||||||
|
@ -2278,6 +2283,8 @@ void MifareCIdent(bool is_mfc) {
|
||||||
|
|
||||||
ReaderTransmit(rats, sizeof(rats), NULL);
|
ReaderTransmit(rats, sizeof(rats), NULL);
|
||||||
res = ReaderReceive(buf, par);
|
res = ReaderReceive(buf, par);
|
||||||
|
if (res ) {
|
||||||
|
|
||||||
// test for some MFC gen2
|
// test for some MFC gen2
|
||||||
if (memcmp(buf, "\x09\x78\x00\x91\x02\xDA\xBC\x19\x10\xF0\x05", 11) == 0) {
|
if (memcmp(buf, "\x09\x78\x00\x91\x02\xDA\xBC\x19\x10\xF0\x05", 11) == 0) {
|
||||||
|
|
||||||
|
@ -2323,6 +2330,7 @@ void MifareCIdent(bool is_mfc) {
|
||||||
isGen = MAGIC_GEN_2;
|
isGen = MAGIC_GEN_2;
|
||||||
goto OUT;
|
goto OUT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_mfc == false) {
|
if (is_mfc == false) {
|
||||||
// magic ntag test
|
// magic ntag test
|
||||||
|
@ -2767,6 +2775,8 @@ void MifareU_Counter_Tearoff(uint8_t counter, uint32_t tearoff_time) {
|
||||||
if (!iso14443a_select_card(NULL, NULL, NULL, true, 0, true)) {
|
if (!iso14443a_select_card(NULL, NULL, NULL, true, 0, true)) {
|
||||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Can't select card");
|
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Can't select card");
|
||||||
OnError(1);
|
OnError(1);
|
||||||
|
switch_off();
|
||||||
|
LEDsoff();
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2775,6 +2785,6 @@ void MifareU_Counter_Tearoff(uint8_t counter, uint32_t tearoff_time) {
|
||||||
LED_D_ON();
|
LED_D_ON();
|
||||||
SpinDelayUsPrecision(tearoff_time);
|
SpinDelayUsPrecision(tearoff_time);
|
||||||
switch_off();
|
switch_off();
|
||||||
|
LEDsoff();
|
||||||
reply_ng(CMD_HF_MFU_COUNTER_TEAROFF, PM3_SUCCESS, NULL, 0);
|
reply_ng(CMD_HF_MFU_COUNTER_TEAROFF, PM3_SUCCESS, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue