int i, res;\r
int keycnt = 0;\r
char ctmp = 0x00;\r
+ int clen = 0;\r
char ctmp3[3] = {0x00};\r
uint8_t blockNo = 0;\r
uint8_t SectorsCnt = 0;\r
blockNo = param_get8(Cmd, 0);\r
\r
ctmp = param_getchar(Cmd, 1);\r
- switch (ctmp) {\r
- case 'a': case 'A':\r
- keyType = 0;\r
- break;\r
- case 'b': case 'B':\r
- keyType = 1;\r
- break;\r
- case '?':\r
- keyType = 2;\r
- break;\r
- default:\r
- PrintAndLog("Key type must be A , B or ?");\r
- free(keyBlock);\r
- return 1;\r
- };\r
+ clen = param_getlength(Cmd, 1);\r
+ if (clen == 1) {\r
+ switch (ctmp) {\r
+ case 'a': case 'A':\r
+ keyType = 0;\r
+ break;\r
+ case 'b': case 'B':\r
+ keyType = 1;\r
+ break;\r
+ case '?':\r
+ keyType = 2;\r
+ break;\r
+ default:\r
+ PrintAndLog("Key type must be A , B or ?");\r
+ free(keyBlock);\r
+ return 1;\r
+ };\r
+ }\r
\r
// transfer to emulator & create dump file\r
ctmp = param_getchar(Cmd, 2);\r
- if (ctmp == 't' || ctmp == 'T') transferToEml = 1;\r
- if (ctmp == 'd' || ctmp == 'D') createDumpFile = 1;\r
+ clen = param_getlength(Cmd, 2);\r
+ if (clen == 1 && (ctmp == 't' || ctmp == 'T')) transferToEml = 1;\r
+ if (clen == 1 && (ctmp == 'd' || ctmp == 'D')) createDumpFile = 1;\r
\r
param3InUse = transferToEml | createDumpFile;\r
\r
timeout14a = 500; // fast by default\r
// double parameters - ts, ds\r
- int clen = param_getlength(Cmd, 2);\r
+ clen = param_getlength(Cmd, 2);\r
if (clen == 2 || clen == 3){\r
param_getstr(Cmd, 2, ctmp3, sizeof(ctmp3));\r
ctmp = ctmp3[1];\r