mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 06:13:51 -07:00
commit
9320c73634
2 changed files with 22 additions and 6 deletions
|
@ -789,7 +789,7 @@ static command_t CommandTable[] = {
|
||||||
{"14b", CmdHF14B, 1, "{ ISO14443B RFIDs... }"},
|
{"14b", CmdHF14B, 1, "{ ISO14443B RFIDs... }"},
|
||||||
{"15", CmdHF15, 1, "{ ISO15693 RFIDs... }"},
|
{"15", CmdHF15, 1, "{ ISO15693 RFIDs... }"},
|
||||||
{"epa", CmdHFEPA, 1, "{ German Identification Card... }"},
|
{"epa", CmdHFEPA, 1, "{ German Identification Card... }"},
|
||||||
{"legic", CmdHFLegic, 0, "{ LEGIC RFIDs... }"},
|
{"legic", CmdHFLegic, 1, "{ LEGIC RFIDs... }"},
|
||||||
{"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"},
|
{"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"},
|
||||||
{"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"},
|
{"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"},
|
||||||
{"mfu", CmdHFMFUltra, 1, "{ MIFARE Ultralight RFIDs... }"},
|
{"mfu", CmdHFMFUltra, 1, "{ MIFARE Ultralight RFIDs... }"},
|
||||||
|
|
|
@ -570,20 +570,36 @@ int CmdLegicCalcCrc8(const char *Cmd){
|
||||||
uint8_t cmdp = 0, uidcrc = 0, type=0;
|
uint8_t cmdp = 0, uidcrc = 0, type=0;
|
||||||
bool errors = false;
|
bool errors = false;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
int bg, en;
|
||||||
|
|
||||||
while(param_getchar(Cmd, cmdp) != 0x00) {
|
while(param_getchar(Cmd, cmdp) != 0x00) {
|
||||||
switch(param_getchar(Cmd, cmdp)) {
|
switch(param_getchar(Cmd, cmdp)) {
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'B':
|
case 'B':
|
||||||
data = malloc(len);
|
// peek at length of the input string so we can
|
||||||
|
// figure out how many elements to malloc in "data"
|
||||||
|
bg=en=0;
|
||||||
|
param_getptr(Cmd, &bg, &en, cmdp+1);
|
||||||
|
len = (en - bg + 1);
|
||||||
|
|
||||||
|
// check that user entered even number of characters
|
||||||
|
// for hex data string
|
||||||
|
if (len & 1) {
|
||||||
|
errors = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// it's possible for user to accidentally enter "b" parameter
|
||||||
|
// more than once - we have to clean previous malloc
|
||||||
|
if (data) free(data);
|
||||||
|
data = malloc(len >> 1);
|
||||||
if ( data == NULL ) {
|
if ( data == NULL ) {
|
||||||
PrintAndLog("Can't allocate memory. exiting");
|
PrintAndLog("Can't allocate memory. exiting");
|
||||||
errors = true;
|
errors = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
param_gethex_ex(Cmd, cmdp+1, data, &len);
|
|
||||||
// if odd symbols, (hexbyte must be two symbols)
|
param_gethex(Cmd, cmdp+1, data, len);
|
||||||
if ( len & 1 ) errors = true;
|
|
||||||
|
|
||||||
len >>= 1;
|
len >>= 1;
|
||||||
cmdp += 2;
|
cmdp += 2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue