]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
FIX: Coverity, unchecked return value, CID #121292,..
authoriceman1001 <iceman@iuse.se>
Tue, 12 Jan 2016 21:30:22 +0000 (22:30 +0100)
committericeman1001 <iceman@iuse.se>
Tue, 12 Jan 2016 21:30:22 +0000 (22:30 +0100)
basicallty the flush queue commmand is replaced with clearCommandBuffer();.

client/cmdhf14a.c
client/cmdhfdes.c
client/cmdhfepa.c
client/cmdhfmf.c
client/cmdhfmfdes.c
client/cmdhfmfdesfire.c
client/cmdhfmfu.c
client/mifarehost.c

index d195267243907fa70e83c68750190fdf6b161617..6d94d33b4fc714b4e7a540b4fcab2dbdd0941d6b 100644 (file)
@@ -790,7 +790,8 @@ static command_t CommandTable[] =
 
 int CmdHF14A(const char *Cmd) {
        // flush
-       WaitForResponseTimeout(CMD_ACK,NULL,100);
+       clearCommandBuffer();
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);
 
        // parse
        CmdsParse(CommandTable, Cmd);
index 1876e5c1a09ddf9dcc7b40ad124bc30c2870274b..200270f0d6e87e2beb679dddb5cfec3e4561ba7a 100644 (file)
@@ -16,11 +16,13 @@ static int CmdHelp(const char *Cmd);
 
 int CmdHFDESReader(const char *Cmd)
 {
-    UsbCommand c  ={CMD_MIFARE_DES_READER, {3, 0x60, 0}};
+    UsbCommand c = { CMD_MIFARE_DES_READER, {3, 0x60, 0} };
     SendCommand(&c);
-
     UsbCommand resp;
-       WaitForResponseTimeout(CMD_ACK,&resp,2000);
+       if (!WaitForResponseTimeout(CMD_ACK,&resp,2000) ){
+               PrintAndLog("Command time-out");
+               return 1;
+       }
     return 0;
 }  
 
@@ -57,7 +59,8 @@ static command_t CommandTable[] =
 int CmdHFDES(const char *Cmd)
 {
     //flush
-    WaitForResponseTimeout(CMD_ACK,NULL,100);
+       clearCommandBuffer();
+    //WaitForResponseTimeout(CMD_ACK,NULL,100);
     CmdsParse(CommandTable, Cmd);
     return 0;
 }
index ed903cf64ce6dbc26d7e3017164db1f2d402cdc3..68176bf664996217ead1413ae57940f99d0709e5 100644 (file)
@@ -197,9 +197,10 @@ int CmdHelp(const char *Cmd)
 int CmdHFEPA(const char *Cmd)
 {
        // flush
-       WaitForResponseTimeout(CMD_ACK,NULL,100);
+       clearCommandBuffer();
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);
 
        // parse
-  CmdsParse(CommandTable, Cmd);
-  return 0;
+       CmdsParse(CommandTable, Cmd);
+       return 0;
 }
index 272f1ade2d2c47a619f90a81a1a27fa0afa240c4..7736b9c51acbfd370a95b799a00d57e753cb47f9 100644 (file)
@@ -2163,7 +2163,8 @@ static command_t CommandTable[] =
 int CmdHFMF(const char *Cmd)\r
 {\r
        // flush\r
-       WaitForResponseTimeout(CMD_ACK,NULL,100);\r
+       clearCommandBuffer();\r
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);\r
        CmdsParse(CommandTable, Cmd);\r
        return 0;\r
 }\r
index 4aeeffd92f83274537a63451c29de395e8a17e1a..b8db1cab960950e04dae389edb5cc9a9e6a508ac 100644 (file)
@@ -636,8 +636,7 @@ int CmdHF14ADesAuth(const char *Cmd){
 }
 
 
-static command_t CommandTable[] =
-{
+static command_t CommandTable[] = {
   {"help",             CmdHelp,                                        1, "This help"},
   {"info",             CmdHF14ADesInfo,                        0, "Get MIFARE DesFire information"},
   {"enum",             CmdHF14ADesEnumApplications,0, "Tries enumerate all applications"},
@@ -647,18 +646,17 @@ static command_t CommandTable[] =
   {NULL, NULL, 0, NULL}
 };
 
-int CmdHFMFDes(const char *Cmd)
-{
+int CmdHFMFDes(const char *Cmd) {
    // flush
-   WaitForResponseTimeout(CMD_ACK,NULL,100);
-   CmdsParse(CommandTable, Cmd);
-  return 0;
+       clearCommandBuffer();
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);
+       CmdsParse(CommandTable, Cmd);
+       return 0;
 }
 
-int CmdHelp(const char *Cmd)
-{
-  CmdsHelp(CommandTable);
-  return 0;
+int CmdHelp(const char *Cmd) {
+       CmdsHelp(CommandTable);
+       return 0;
 }
 
 
index f2c53dbf2eb6b8ae7b45de8d4da263d9cf8b31bc..576792d0297fb10814dd36b9191223f24dc503d5 100644 (file)
@@ -239,7 +239,8 @@ static command_t CommandTable[] =
 
 int CmdHFMFDesfire(const char *Cmd){
     // flush
-    WaitForResponseTimeout(CMD_ACK,NULL,100);
+       clearCommandBuffer();
+    //WaitForResponseTimeout(CMD_ACK,NULL,100);
     CmdsParse(CommandTable, Cmd);
     return 0;
 }
index 7567efb8be8760de4043fe186195ecea02cf930f..c7de6c7dc62a9771d1abe261b62ca3697b78d6c6 100644 (file)
@@ -2025,7 +2025,8 @@ static command_t CommandTable[] =
 };
 
 int CmdHFMFUltra(const char *Cmd){
-       WaitForResponseTimeout(CMD_ACK,NULL,100);
+       clearCommandBuffer();
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);
        CmdsParse(CommandTable, Cmd);
        return 0;
 }
index e6ad6016e04cea011ff4879f66974cd46b290a38..1cb228bb68881c9be22c9ae7478b317cff6b0455 100644 (file)
@@ -79,7 +79,8 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo
        struct Crypto1State *p1, *p2, *p3, *p4;\r
        \r
        // flush queue\r
-       WaitForResponseTimeout(CMD_ACK,NULL,100);\r
+       clearCommandBuffer();\r
+       //WaitForResponseTimeout(CMD_ACK,NULL,100);\r
        \r
        UsbCommand c = {CMD_MIFARE_NESTED, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, calibrate}};\r
        memcpy(c.d.asBytes, key, 6);\r
Impressum, Datenschutz