//----------------------------------------------\r
// Nested\r
//----------------------------------------------\r
-# define NESTED_KEY_COUNT 15\r
\r
static void parseParamTDS(const char *Cmd, const uint8_t indx, bool *paramT, bool *paramD, uint8_t *timeout) {\r
char ctmp3[3] = {0};\r
int len = param_getlength(Cmd, indx);\r
if (len > 0 && len < 4){\r
- param_getstr(Cmd, indx, ctmp3);\r
+ param_getstr(Cmd, indx, ctmp3, sizeof(ctmp3));\r
\r
*paramT |= (ctmp3[0] == 't' || ctmp3[0] == 'T');\r
*paramD |= (ctmp3[0] == 'd' || ctmp3[0] == 'D');\r
uint8_t trgKeyType = 0;\r
uint8_t SectorsCnt = 0;\r
uint8_t key[6] = {0, 0, 0, 0, 0, 0};\r
- uint8_t keyBlock[NESTED_KEY_COUNT * 6];\r
+ uint8_t keyBlock[MifareDefaultKeysSize * 6];\r
uint64_t key64 = 0;\r
// timeout in units. (ms * 106)/10 or us*0.0106\r
uint8_t btimeout14a = MF_CHKKEYS_DEFTIMEOUT; // fast by default\r
}\r
\r
PrintAndLog("Testing known keys. Sector count=%d", SectorsCnt);\r
- mfCheckKeysSec(SectorsCnt, 2, btimeout14a, true, NESTED_KEY_COUNT, keyBlock, e_sector);\r
+ mfCheckKeysSec(SectorsCnt, 2, btimeout14a, true, MifareDefaultKeysSize, keyBlock, e_sector);\r
\r
// get known key from array\r
bool keyFound = false;\r
// double parameters - ts, ds\r
int clen = param_getlength(Cmd, 2);\r
if (clen == 2 || clen == 3){\r
- param_getstr(Cmd, 2, ctmp3);\r
+ param_getstr(Cmd, 2, ctmp3, sizeof(ctmp3));\r
ctmp = ctmp3[1];\r
}\r
//parse\r
keycnt++;\r
} else {\r
// May be a dic file\r
- if ( param_getstr(Cmd, 2 + i,filename) >= FILE_PATH_SIZE ) {\r
+ if ( param_getstr(Cmd, 2 + i, filename, sizeof(filename)) >= FILE_PATH_SIZE ) {\r
PrintAndLog("File name too long");\r
free(keyBlock);\r
return 2;\r
break;\r
case 'f':\r
case 'F':\r
- len = param_getstr(Cmd, cmdp+1, filename);\r
+ len = param_getstr(Cmd, cmdp+1, filename, sizeof(filename));\r
if (len < 1) {\r
PrintAndLog("error no filename found");\r
return 0;\r
}\r
}\r
\r
- len = param_getstr(Cmd,nameParamNo,filename);\r
+ len = param_getstr(Cmd,nameParamNo,filename,sizeof(filename));\r
\r
if (len > FILE_PATH_SIZE - 5) len = FILE_PATH_SIZE - 5;\r
\r
}\r
}\r
\r
- len = param_getstr(Cmd,nameParamNo,filename);\r
+ len = param_getstr(Cmd,nameParamNo,filename,sizeof(filename));\r
\r
if (len > FILE_PATH_SIZE - 5) len = FILE_PATH_SIZE - 5;\r
\r
bool fillCard = false;\r
\r
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {\r
- PrintAndLog("Usage: hf mf cwipe [card size] [w] [p]");\r
- PrintAndLog("sample: hf mf cwipe 1 w s");\r
+ PrintAndLog("Usage: hf mf cwipe [card size] [w] [f]");\r
+ PrintAndLog("sample: hf mf cwipe 1 w f");\r
PrintAndLog("[card size]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K");\r
PrintAndLog("w - Wipe magic Chinese card (only works with gen:1a cards)");\r
PrintAndLog("f - Fill the card with default data and keys (works with gen:1a and gen:1b cards only)");\r
}\r
return 0;\r
} else {\r
- param_getstr(Cmd, 0, filename);\r
+ param_getstr(Cmd, 0, filename, sizeof(filename));\r
\r
len = strlen(filename);\r
if (len > FILE_PATH_SIZE - 5) len = FILE_PATH_SIZE - 5;\r
}\r
return 0;\r
} else {\r
- param_getstr(Cmd, 0, filename);\r
+ param_getstr(Cmd, 0, filename, sizeof(filename));\r
\r
len = strlen(filename);\r
if (len > FILE_PATH_SIZE - 5) len = FILE_PATH_SIZE - 5;\r