]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
fix #532. looks at length of parameters. 533/head
authormerlokk <olegmsn@gmail.com>
Thu, 28 Dec 2017 11:29:30 +0000 (13:29 +0200)
committermerlokk <olegmsn@gmail.com>
Thu, 28 Dec 2017 11:29:30 +0000 (13:29 +0200)
client/cmdhfmf.c

index d9578af25768e8aa0e6e7b5d4a91101bb5ea1cd9..cca4da88bdd04ed0ace3d044efaceebba70da8a1 100644 (file)
@@ -987,6 +987,7 @@ int CmdHF14AMfChk(const char *Cmd)
        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
@@ -1015,32 +1016,36 @@ int CmdHF14AMfChk(const char *Cmd)
                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
Impressum, Datenschutz