mirror of
https://github.com/RfidResearchGroup/ChameleonMini.git
synced 2026-05-12 11:20:37 -07:00
not allow to write block 0
This commit is contained in:
@@ -1020,12 +1020,20 @@ uint16_t MifareClassicAppProcess(uint8_t *Buffer, uint16_t BitCount) {
|
||||
}
|
||||
} else if (Buffer[0] == CMD_WRITE) {
|
||||
if (ISO14443ACheckCRCA(Buffer, CMD_WRITE_FRAME_SIZE)) {
|
||||
DetectionLogToFlash(LOG_INFO_APP_CMD_WRITE, Buffer, 2);
|
||||
/* Write command. Store the address and prepare for the upcoming data.
|
||||
* Respond with ACK. */
|
||||
CurrentAddress = Buffer[1];
|
||||
State = STATE_WRITE;
|
||||
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
||||
// not allow to write block 0
|
||||
if (Buffer[1] == 0x00) {
|
||||
State = STATE_HALT;
|
||||
Buffer[0] = NAK_NOT_AUTHED ^ Crypto1Nibble();
|
||||
return ACK_NAK_FRAME_SIZE;
|
||||
}
|
||||
else {
|
||||
DetectionLogToFlash(LOG_INFO_APP_CMD_WRITE, Buffer, 2);
|
||||
/* Write command. Store the address and prepare for the upcoming data.
|
||||
* Respond with ACK. */
|
||||
CurrentAddress = Buffer[1];
|
||||
State = STATE_WRITE;
|
||||
Buffer[0] = ACK_VALUE ^ Crypto1Nibble();
|
||||
}
|
||||
} else {
|
||||
LogEntry(LOG_ERR_APP_CHECKSUM_FAIL, Buffer, 4);
|
||||
Buffer[0] = NAK_CRC_ERROR ^ Crypto1Nibble();
|
||||
|
||||
Reference in New Issue
Block a user