]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhf14b.c
fixing iso14443b (issue #103):
[proxmark3-svn] / client / cmdhf14b.c
index 525ffcc63d1d62a79c14c1845ff8099fe3390b06..21a4e1799eec516c84d094067e9f4bf1c15db2f6 100644 (file)
@@ -288,7 +288,7 @@ int CmdHF14BCmdRaw (const char *cmd) {
         if (WaitForResponseTimeout(CMD_ACK,&resp,1000)) {
             recv = resp.d.asBytes;
             PrintAndLog("received %i octets",resp.arg[0]);
-            if(!resp.arg[0])
+            if(resp.arg[0] == 0)
                 return 0;
             hexout = (char *)malloc(resp.arg[0] * 3 + 1);
             if (hexout != NULL) {
@@ -298,11 +298,13 @@ int CmdHF14BCmdRaw (const char *cmd) {
                 }
                 PrintAndLog("%s", hexout);
                 free(hexout);
-                ComputeCrc14443(CRC_14443_B, recv, resp.arg[0]-2, &first, &second);
-                if(recv[resp.arg[0]-2]==first && recv[resp.arg[0]-1]==second) {
-                    PrintAndLog("CRC OK");
-                } else {
-                    PrintAndLog("CRC failed");
+                               if (resp.arg[0] > 2) {
+                                       ComputeCrc14443(CRC_14443_B, recv, resp.arg[0]-2, &first, &second);
+                                       if(recv[resp.arg[0]-2]==first && recv[resp.arg[0]-1]==second) {
+                                               PrintAndLog("CRC OK");
+                                       } else {
+                                               PrintAndLog("CRC failed");
+                                       }
                 }
             } else {
                 PrintAndLog("malloc failed your client has low memory?");
Impressum, Datenschutz